rename_note
Change the name or location of a note in your Obsidian vault by specifying its current and new 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 performs the rename/move operation: resolves full paths, validates existence of old and absence of new path, ensures target directory exists, and renames the file using Node.js 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)JSON schema defining the input parameters for the rename_note tool: oldPath (current note path) and newPath (new note path), both required strings.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:132-148 (registration)Tool registration in the tools array, which is returned by the list tools handler, including name, description, and input schema.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-892 (registration)Registration in the main tool dispatch switch statement that routes calls to the handleRenameNote function.case "rename_note": result = await handleRenameNote( args as { oldPath: string; newPath: string } ); break;