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.
86 lines • 4.01 kB
TypeScript
/**
* @fileoverview obsidian_manage_frontmatter — atomic get/set/delete on a single
* frontmatter key. `set` PATCHes the field; `delete` reads-modifies-writes the
* file because PATCH has no `delete` operation.
* @module mcp-server/tools/definitions/obsidian-manage-frontmatter.tool
*/
import { z } from '@cyanheads/mcp-ts-core';
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
export declare const obsidianManageFrontmatter: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
operation: z.ZodEnum<{
set: "set";
delete: "delete";
get: "get";
}>;
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">;
key: z.ZodString;
value: z.ZodOptional<z.ZodUnknown>;
}, z.core.$strip>, z.ZodObject<{
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
operation: z.ZodLiteral<"get">;
path: z.ZodString;
key: z.ZodString;
exists: z.ZodBoolean;
value: z.ZodUnknown;
}, z.core.$strip>, z.ZodObject<{
operation: z.ZodLiteral<"set">;
path: z.ZodString;
key: z.ZodString;
frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
previousSizeInBytes: z.ZodNumber;
currentSizeInBytes: z.ZodNumber;
}, z.core.$strip>, z.ZodObject<{
operation: z.ZodLiteral<"delete">;
path: z.ZodString;
key: z.ZodString;
frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
previousSizeInBytes: z.ZodNumber;
currentSizeInBytes: z.ZodNumber;
}, z.core.$strip>], "operation">;
}, z.core.$strip>, readonly [{
readonly reason: "path_forbidden";
readonly code: JsonRpcErrorCode.Forbidden;
readonly when: "`get` requires the path to be readable; `set`/`delete` require it to be inside OBSIDIAN_WRITE_PATHS, with OBSIDIAN_READ_ONLY=false.";
readonly recovery: "Use a path inside the configured scope. The error data echoes the active scope.";
}, {
readonly reason: "value_required";
readonly code: JsonRpcErrorCode.ValidationError;
readonly when: "`operation` is \"set\" but no `value` was supplied.";
readonly recovery: "Pass `value` as any JSON-typed value: string, number, boolean, array, or object (e.g. `\"draft\"`, `42`, `true`, `[\"a\",\"b\"]`).";
}, {
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-manage-frontmatter.tool.d.ts.map