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.

124 lines 5.63 kB
/** * @fileoverview obsidian_get_note read a note's content, full NoteJson, * structural document map, or a single section. * @module mcp-server/tools/definitions/obsidian-get-note.tool */ import { z } from '@cyanheads/mcp-ts-core'; import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors'; export declare const obsidianGetNote: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{ format: z.ZodEnum<{ content: "content"; section: "section"; full: "full"; "document-map": "document-map"; }>; 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">; section: z.ZodOptional<z.ZodObject<{ type: z.ZodEnum<{ heading: "heading"; block: "block"; frontmatter: "frontmatter"; }>; target: z.ZodString; }, z.core.$strip>>; includeLinks: z.ZodDefault<z.ZodBoolean>; }, z.core.$strip>, z.ZodObject<{ result: z.ZodDiscriminatedUnion<[z.ZodObject<{ format: z.ZodLiteral<"content">; path: z.ZodString; content: z.ZodString; }, z.core.$strip>, z.ZodObject<{ format: z.ZodLiteral<"full">; path: z.ZodString; content: z.ZodString; frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>; tags: z.ZodArray<z.ZodString>; stat: z.ZodObject<{ ctime: z.ZodNumber; mtime: z.ZodNumber; size: z.ZodNumber; }, z.core.$strip>; outgoingLinks: z.ZodOptional<z.ZodArray<z.ZodObject<{ target: z.ZodString; type: z.ZodEnum<{ markdown: "markdown"; wikilink: "wikilink"; }>; }, z.core.$strip>>>; }, z.core.$strip>, z.ZodObject<{ format: z.ZodLiteral<"document-map">; path: z.ZodString; headings: z.ZodArray<z.ZodString>; blocks: z.ZodArray<z.ZodString>; frontmatterFields: z.ZodArray<z.ZodString>; }, z.core.$strip>, z.ZodObject<{ format: z.ZodLiteral<"section">; path: z.ZodString; section: z.ZodObject<{ type: z.ZodEnum<{ heading: "heading"; block: "block"; frontmatter: "frontmatter"; }>; target: z.ZodString; }, z.core.$strip>; valueText: z.ZodOptional<z.ZodString>; valueJson: z.ZodOptional<z.ZodUnknown>; }, z.core.$strip>], "format">; }, z.core.$strip>, readonly [{ readonly reason: "section_required"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "`format` is \"section\" but no `section` locator was provided."; readonly recovery: "Pass `section: { type, target }` (e.g. `{ type: \"heading\", target: \"Intro\" }`), or use `format: \"full\"` / `\"document-map\"` instead."; }, { readonly reason: "path_forbidden"; readonly code: JsonRpcErrorCode.Forbidden; readonly when: "The target path is outside OBSIDIAN_READ_PATHS (and OBSIDIAN_WRITE_PATHS, since write paths imply read access)."; readonly recovery: "Use a path inside the configured read scope. The error data echoes the active scope."; }, { readonly reason: "note_missing"; 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: "ambiguous_path"; readonly code: JsonRpcErrorCode.Conflict; readonly when: "The parent directory contains multiple files whose names differ only in case (case-sensitive filesystems only)."; readonly recovery: "Retry with one of the exact paths listed in `matches` on the error data."; }, { 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_missing"; readonly code: JsonRpcErrorCode.NotFound; readonly when: "`format` was `\"section\"` and the named heading, block reference, or frontmatter field does not exist in the resolved note."; readonly recovery: "Call obsidian_get_note with format \"document-map\" to list available headings, blocks, and frontmatter fields. Nested headings need Parent::Child syntax."; }], undefined>; //# sourceMappingURL=obsidian-get-note.tool.d.ts.map