Skip to main content
Glama

rename_note

Update a note's title while keeping its filename and ID intact to maintain existing links. Automatically adjusts wikilinks in other notes to reference the new title, ensuring consistency across your knowledge base.

Instructions

Rename a note by updating its title field (display name). The filename and ID remain unchanged to preserve links. Automatically updates wikilinks in other notes that reference the old title.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
content_hashYesContent hash of the current note for optimistic locking
identifierYesNote identifier in format "type/filename" or full path
new_titleYesNew display title for the note
vault_idNoOptional vault ID to operate on. If not provided, uses the current active vault.

Implementation Reference

  • The primary handler function for the 'rename_note' MCP tool. It validates input, retrieves the current note, updates only the title in metadata (preserving filename and content), bypasses protections for rename, updates broken links and wikilinks across the vault using LinkExtractor, and returns detailed success/error information.
    handleRenameNote = async (args: RenameNoteArgs) => { try { // Validate arguments validateToolArgs('rename_note', args); const { noteManager, hybridSearchManager } = await this.resolveVaultContext( args.vault_id ); // Get the current note to read current metadata const currentNote = await noteManager.getNote(args.identifier); if (!currentNote) { throw new Error(`Note '${args.identifier}' not found`); } // Update the title in metadata while preserving all other metadata const updatedMetadata = { ...currentNote.metadata, title: args.new_title }; // Use the existing updateNoteWithMetadata method with protection bypass for rename const result = await noteManager.updateNoteWithMetadata( args.identifier, currentNote.content, // Keep content unchanged updatedMetadata, args.content_hash, true // Bypass protection for legitimate rename operations ); let brokenLinksUpdated = 0; let wikilinksResult = { notesUpdated: 0, linksUpdated: 0 }; // Update links using the vault-specific hybrid search manager const db = await hybridSearchManager.getDatabaseConnection(); const noteId = this.generateNoteIdFromIdentifier(args.identifier); // Update broken links that might now be resolved due to the new title brokenLinksUpdated = await LinkExtractor.updateBrokenLinks( noteId, args.new_title, db ); // Always update wikilinks in other notes wikilinksResult = await LinkExtractor.updateWikilinksForRenamedNote( noteId, currentNote.title, args.new_title, db ); let wikilinkMessage = ''; if (brokenLinksUpdated > 0) { wikilinkMessage = `\n\n🔗 Updated ${brokenLinksUpdated} broken links that now resolve to this note.`; } if (wikilinksResult.notesUpdated > 0) { wikilinkMessage += `\n🔗 Updated ${wikilinksResult.linksUpdated} wikilinks in ${wikilinksResult.notesUpdated} notes that referenced the old title.`; } return { content: [ { type: 'text', text: JSON.stringify( { success: true, message: `Note renamed successfully${wikilinkMessage}`, old_title: currentNote.title, new_title: args.new_title, identifier: args.identifier, filename_unchanged: true, links_preserved: true, broken_links_resolved: brokenLinksUpdated, wikilinks_updated: true, notes_with_updated_wikilinks: wikilinksResult.notesUpdated, total_wikilinks_updated: wikilinksResult.linksUpdated, result }, null, 2 ) } ] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; return { content: [ { type: 'text', text: JSON.stringify( { success: false, error: errorMessage }, null, 2 ) } ], isError: true }; }
  • MCP server tool call registration: Maps incoming 'rename_note' tool calls to the NoteHandlers.handleRenameNote method.
    case 'rename_note': return await this.noteHandlers.handleRenameNote( args as unknown as RenameNoteArgs );
  • Tool schema definition returned by ListToolsRequest, including name, description, and inputSchema for 'rename_note'.
    name: 'rename_note', description: 'Rename a note by updating its title field (display name). The filename and ID remain unchanged to preserve links. Automatically updates wikilinks in other notes that reference the old title.', inputSchema: { type: 'object', properties: { identifier: { type: 'string', description: 'Note identifier in format "type/filename" or full path' }, new_title: { type: 'string', description: 'New display title for the note' }, content_hash: { type: 'string', description: 'Content hash of the current note for optimistic locking' }, vault_id: { type: 'string', description: 'Optional vault ID to operate on. If not provided, uses the current active vault.' } }, required: ['identifier', 'new_title', 'content_hash'] }
  • TypeScript interface defining the input arguments for the rename_note tool handler.
    export interface RenameNoteArgs { identifier: string; new_title: string; content_hash: string; vault_id?: string; }
  • Validation rules used by validateToolArgs('rename_note', args) to ensure correct input structure and format identifier as type/filename.
    rename_note: [ { field: 'identifier', required: true, type: 'string', allowEmpty: false, customValidator: (value: any) => { if (!value.includes('/')) { return 'identifier must be in format "type/filename"'; } return null; } }, { field: 'new_title', required: true, type: 'string', allowEmpty: false }, { field: 'content_hash', required: true, type: 'string', allowEmpty: false }, { field: 'vault_id', required: false, type: 'string', allowEmpty: false } ],

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/disnet/flint-note'

If you have feedback or need assistance with the MCP directory API, please join our Discord server