/** * @fileoverview obsidian_append_to_note — append content to the end of a note, * or to the end of a heading/block/frontmatter section via PATCH-with-append. * Whole-file appends are silently upserts (POST creates the file when the path * does not exist), so the response surface flags `created` and `previousSize` * for agent self-correction. * @module mcp-server/tools/definitions/obsidian-append-to-note.tool */ import { z } from '@cyanheads/mcp-ts-core'; import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors'; export declare const obsidianAppendToNote: 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">; content: z.ZodString; section: z.ZodOptional; target: z.ZodString; }, z.core.$strip>>; contentType: z.ZodDefault>; createTargetIfMissing: z.ZodDefault; }, z.core.$strip>, z.ZodObject<{ path: z.ZodString; sectionTargeted: z.ZodBoolean; sectionTarget: z.ZodOptional; created: z.ZodBoolean; previousSizeInBytes: z.ZodNumber; currentSizeInBytes: z.ZodNumber; }, z.core.$strip>, readonly [{ readonly reason: "case_variant_exists"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.Conflict; readonly when: "Whole-file append to a path that differs from an existing note only in letter case, on a case-insensitive filesystem (macOS, Windows) where both name one file. `existingPath` names that note when the parent folder listing shows exactly one case match; it is omitted when several match, and when a file Obsidian does not index, such as a dot-file, already sits at the path."; readonly recovery: "Retry with the path in `existingPath` on the error data, which names the same file. Without `existingPath`, list the folder with obsidian_list_notes and use the spelling it shows, or choose another path."; }, { 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: "Section append targets a path that does not resolve to an existing note (PATCH requires the file to exist)."; readonly recovery: "Verify the path with obsidian_list_notes, or omit `section` to fall back to whole-file append (which creates the note if missing)."; }, { 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: "`section` was provided but the named heading/block/frontmatter field does not exist in the note."; readonly recovery: "Call obsidian_get_note with format document-map to discover available targets, or pass createTargetIfMissing: true to bring it into existence."; }, { 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 append 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: "Section append where the supplied content already appears at the target — rejected to keep retries idempotent (the default for the section path)."; readonly recovery: "Change the content to something not already present at the target, or use obsidian_patch_note with `patchOptions.applyIfContentPreexists: true` if a duplicate is intended."; }, { readonly reason: "heading_outside_section"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "On Local REST API v5.0 and later, content appended to a heading carries a heading at or above that 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 (no `section`), 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 append 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 append."; }, { readonly reason: "patch_rejected"; readonly thrownBy: "service"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "The section 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-append-to-note.tool.d.ts.map