update_note
Replace the entire content of an existing note in your Obsidian vault by specifying the file path and new content.
Instructions
Update/replace the entire content of an existing note
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the note to update relative to vault root | |
| content | Yes | New content for the note |
Implementation Reference
- src/index.ts:464-476 (handler)The core handler function that executes the update_note tool logic: resolves the note path, verifies existence, overwrites the file content with the provided content, and returns a success message.async function handleUpdateNote(args: { path: string; content: string; }): Promise<string> { const fullPath = resolvePath(args.path); if (!(await fileExists(fullPath))) { throw new Error(`Note not found at ${args.path}`); } await fs.writeFile(fullPath, args.content, "utf-8"); return `Successfully updated note at ${args.path}`; }
- src/index.ts:64-81 (registration)Registers the update_note tool in the tools array, including name, description, and input schema definition. This is used by the ListToolsRequest handler.{ name: "update_note", description: "Update/replace the entire content of an existing note", inputSchema: { type: "object", properties: { path: { type: "string", description: "Path to the note to update relative to vault root", }, content: { type: "string", description: "New content for the note", }, }, required: ["path", "content"], }, },
- src/index.ts:873-877 (registration)Registers the handler for update_note tool calls within the switch statement in the CallToolRequest handler.case "update_note": result = await handleUpdateNote( args as { path: string; content: string } ); break;
- src/index.ts:67-80 (schema)Defines the input schema for the update_note tool, specifying required path and content properties.inputSchema: { type: "object", properties: { path: { type: "string", description: "Path to the note to update relative to vault root", }, content: { type: "string", description: "New content for the note", }, }, required: ["path", "content"], },