rename_note
Change the name or location of an Obsidian note by specifying its current and new file paths.
Instructions
Rename or move a note to a new location
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| oldPath | Yes | Current path of the note | |
| newPath | Yes | New path for the note |
Implementation Reference
- src/index.ts:522-540 (handler)The handler function that executes the rename_note tool: resolves paths, validates existence, creates directories if needed, and renames the file using fs.rename.async function handleRenameNote(args: { oldPath: string; newPath: string; }): Promise<string> { const oldFullPath = resolvePath(args.oldPath); const newFullPath = resolvePath(args.newPath); if (!(await fileExists(oldFullPath))) { throw new Error(`Note not found at ${args.oldPath}`); } if (await fileExists(newFullPath)) { throw new Error(`Note already exists at ${args.newPath}`); } await ensureDir(newFullPath); await fs.rename(oldFullPath, newFullPath); return `Successfully moved note from ${args.oldPath} to ${args.newPath}`; }
- src/index.ts:134-147 (schema)Input schema for the rename_note tool, specifying oldPath and newPath as required string parameters.inputSchema: { type: "object", properties: { oldPath: { type: "string", description: "Current path of the note", }, newPath: { type: "string", description: "New path for the note", }, }, required: ["oldPath", "newPath"], },
- src/index.ts:131-148 (registration)Registration of the rename_note tool in the tools array, which is returned by list_tools.{ name: "rename_note", description: "Rename or move a note to a new location", inputSchema: { type: "object", properties: { oldPath: { type: "string", description: "Current path of the note", }, newPath: { type: "string", description: "New path for the note", }, }, required: ["oldPath", "newPath"], }, },
- src/index.ts:888-891 (registration)Registration of the handler in the main tool dispatch switch statement for call_tool requests.case "rename_note": result = await handleRenameNote( args as { oldPath: string; newPath: string } );