UNPKG

obsidian-mcp-server

Version:

MCP server for Obsidian vaults — read, write, search, and surgically edit notes, tags, and frontmatter via the Local REST API plugin. STDIO or Streamable HTTP.

84 lines 4.36 kB
/** * @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<z.ZodObject<{ target: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"path">; 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"; weekly: "weekly"; monthly: "monthly"; quarterly: "quarterly"; yearly: "yearly"; }>; date: z.ZodOptional<z.ZodString>; }, z.core.$strip>], "type">; content: z.ZodString; section: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<{ heading: "heading"; block: "block"; frontmatter: "frontmatter"; }>; target: z.ZodString; }, z.core.$strip>>; contentType: z.ZodDefault<z.ZodEnum<{ markdown: "markdown"; json: "json"; }>>; createTargetIfMissing: z.ZodDefault<z.ZodBoolean>; }, z.core.$strip>, z.ZodObject<{ path: z.ZodString; sectionTargeted: z.ZodBoolean; created: z.ZodBoolean; previousSizeInBytes: z.ZodNumber; currentSizeInBytes: z.ZodNumber; }, z.core.$strip>, readonly [{ readonly reason: "path_forbidden"; readonly code: JsonRpcErrorCode.Forbidden; readonly when: "The target path is outside OBSIDIAN_WRITE_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."; }, { readonly reason: "note_missing"; 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 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_not_found"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "Target was `periodic` but no matching periodic note exists."; readonly recovery: "Create the periodic note first or pass an explicit path target."; }, { readonly reason: "periodic_disabled"; 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 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: "content_preexists"; 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."; }], undefined>; //# sourceMappingURL=obsidian-append-to-note.tool.d.ts.map