/** * @fileoverview obsidian_patch_note — surgical edit (`append` / `prepend` / * `replace`) of a heading, block reference, or frontmatter field, through the * Local REST API's PATCH endpoint in whichever markdown-patch format the * installed plugin speaks. * @module mcp-server/tools/definitions/obsidian-patch-note.tool */ import { z } from '@cyanheads/mcp-ts-core'; import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors'; export declare const obsidianPatchNote: import("@cyanheads/mcp-ts-core").ToolDefinition; path: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"active">; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"periodic">; period: z.ZodEnum<{ daily: "daily"; monthly: "monthly"; quarterly: "quarterly"; weekly: "weekly"; yearly: "yearly"; }>; date: z.ZodOptional; }, z.core.$strip>], "type">; section: z.ZodObject<{ type: z.ZodEnum<{ block: "block"; frontmatter: "frontmatter"; heading: "heading"; }>; target: z.ZodString; }, z.core.$strip>; operation: z.ZodEnum<{ append: "append"; prepend: "prepend"; replace: "replace"; }>; content: z.ZodString; contentType: z.ZodDefault>; patchOptions: z.ZodOptional; applyIfContentPreexists: z.ZodDefault; trimTargetWhitespace: z.ZodDefault; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ path: z.ZodString; section: z.ZodObject<{ type: z.ZodEnum<{ block: "block"; frontmatter: "frontmatter"; heading: "heading"; }>; target: z.ZodString; }, z.core.$strip>; operation: z.ZodEnum<{ append: "append"; prepend: "prepend"; replace: "replace"; }>; previousSizeInBytes: z.ZodNumber; currentSizeInBytes: z.ZodNumber; }, z.core.$strip>, readonly [{ readonly reason: "path_forbidden"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.Forbidden; readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS or inside OBSIDIAN_DENY_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes."; readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope; a `denied_path` denial carries none, since the operator withholds that path."; }, { readonly reason: "note_missing"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "The vault path does not resolve to an existing note."; readonly recovery: "Verify the path with obsidian_list_notes or use obsidian_search_notes to locate the note."; }, { readonly reason: "no_active_file"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "Target was `active` but no file is currently open in Obsidian."; readonly recovery: "Call obsidian_open_in_ui to focus a file, or pass an explicit path target instead."; }, { readonly reason: "periodic_unsupported"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "Target was `periodic` and this vault runs Local REST API v5.0.2 or later without the companion periodic-notes extension, so the `/periodic/` routes are not served at all."; readonly recovery: "Install the periodic-notes extension from https://github.com/coddingtonbear/obsidian-local-rest-api-periodic-notes, or address the note by an explicit vault path."; }, { readonly reason: "periodic_not_found"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "Target was `periodic`, the `/periodic/` routes are served on this vault, and no note exists for the requested period."; readonly recovery: "Create the periodic note first or pass an explicit path target."; }, { readonly reason: "periodic_disabled"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "Target was `periodic` but the requested period is not enabled in Obsidian's Periodic Notes plugin settings."; readonly recovery: "Pass an explicit path target — the requested period is disabled in the operator's Periodic Notes plugin."; }, { readonly reason: "section_target_missing"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The named heading/block/frontmatter field does not exist in the note. Use `obsidian_get_note` with `format: \"document-map\"` to discover available targets."; readonly recovery: "Call obsidian_get_note with format document-map to discover the available targets."; }, { readonly reason: "ambiguous_section"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.Conflict; readonly when: "A bare heading leaf name matches more than one heading in the note, or the resolved full heading path occurs more than once, so the write target is undetermined."; readonly recovery: "Retry with a distinct full Parent::Child heading path from `candidates` on the error data; when every candidate is the same path, rename the repeated headings first."; }, { readonly reason: "content_preexists"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The supplied content already appears at the target — the patch was rejected to keep retries idempotent (the default)."; readonly recovery: "Pass `patchOptions.applyIfContentPreexists: true` to force-apply over preexisting content, or change the content to something not already present."; }, { readonly reason: "heading_outside_section"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "On Local REST API v5.0 and later, the content of a heading write carries a heading at or above the target section’s own level, which would have to sit outside the section."; readonly recovery: "Append the heading at the parent section or at the end of the note with obsidian_append_to_note, or write it one level below the target section or deeper."; }, { readonly reason: "repeated_link_definition"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.Conflict; readonly when: "A link reference definition that repeats a label defined earlier in the note sits above where the target heading’s section ends (for the last section, above its heading); the Local REST API’s markdown parser drops it and misplaces every heading below it, so the write would land outside the section."; readonly recovery: "Use obsidian_replace_in_note to place the content directly, or to remove or rename the repeated definition at `line`, then retry the section write."; }, { readonly reason: "patch_rejected"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The target exists but the plugin refused the content for it — table rows for a block that is not a table, a row with the wrong cell count, a frontmatter value that cannot merge, or content of the wrong shape."; readonly recovery: "Read the target with obsidian_get_note format section, then send content that fits it — rows matching the table columns, or a value of the field’s own type."; }, { readonly reason: "path_is_directory"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The supplied path names a folder rather than a note file."; readonly recovery: "Call obsidian_list_notes with this path to list the folder, then retry with the full path of one of the files it returns."; }, { readonly reason: "path_traversal"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The path contains a `.` or `..` segment, which is rejected to prevent vault escape."; readonly recovery: "Supply a vault-relative path with no `.` or `..` segments, e.g. \"Projects/Note.md\". Use obsidian_list_notes to browse the vault."; }], undefined>; //# sourceMappingURL=obsidian-patch-note.tool.d.ts.map