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.

75 lines 3.72 kB
/** * @fileoverview obsidian_replace_in_note — string/regex search-replace inside a * single note. Composed read → mutate → write at the service layer; replacements * are applied sequentially over the evolving body. * @module mcp-server/tools/definitions/obsidian-replace-in-note.tool */ import { z } from '@cyanheads/mcp-ts-core'; import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors'; export declare const obsidianReplaceInNote: 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">; replacements: z.ZodArray<z.ZodObject<{ search: z.ZodString; replace: z.ZodString; useRegex: z.ZodDefault<z.ZodBoolean>; caseSensitive: z.ZodDefault<z.ZodBoolean>; wholeWord: z.ZodDefault<z.ZodBoolean>; flexibleWhitespace: z.ZodDefault<z.ZodBoolean>; replaceAll: z.ZodDefault<z.ZodBoolean>; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ path: z.ZodString; totalReplacements: z.ZodNumber; perReplacement: z.ZodArray<z.ZodObject<{ search: z.ZodString; count: z.ZodNumber; }, z.core.$strip>>; 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. (The pre-read also requires the path to be readable.)"; readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope."; }, { readonly reason: "regex_invalid"; readonly code: JsonRpcErrorCode.ValidationError; readonly when: "A `useRegex: true` replacement supplied a `search` pattern that is not a valid ECMAScript regex."; readonly recovery: "Use a valid ECMAScript regex, or set useRegex to false to match `search` as a literal string."; }, { 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: "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."; }], undefined>; //# sourceMappingURL=obsidian-replace-in-note.tool.d.ts.map