Skip to main content
Glama
disnet
by disnet

rename_note

Update a note's display title while preserving file links and automatically adjusting references in connected notes.

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
identifierYesNote identifier in format "type/filename" or full path
new_titleYesNew display title for the note
content_hashYesContent hash of the current note for optimistic locking
vault_idNoOptional vault ID to operate on. If not provided, uses the current active vault.

Implementation Reference

  • Primary handler function for the 'rename_note' MCP tool. Validates input, updates note title metadata via noteManager while preserving content, bypasses protections, and automatically updates wikilinks and broken links across the vault.
    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
        };
      }
    };
  • Tool dispatch registration in the main MCP server CallToolRequestHandler switch statement, routing 'rename_note' calls to NoteHandlers.handleRenameNote method.
    case 'rename_note':
      return await this.noteHandlers.handleRenameNote(
        args as unknown as RenameNoteArgs
      );
  • Tool schema definition provided in the ListToolsRequestHandler response for the 'rename_note' tool, including description and input schema.
    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;
    }
  • Standalone tool schema configuration for 'rename_note' in TOOL_SCHEMAS array (potentially used for documentation or external reference).
      name: 'rename_note',
      description: 'Rename a note and update any wikilinks that reference it',
      inputSchema: {
        type: 'object',
        properties: {
          identifier: {
            type: 'string',
            description: 'Current note identifier in type/filename format'
          },
          new_title: {
            type: 'string',
            description: 'New title for the note'
          },
          content_hash: {
            type: 'string',
            description: 'Content hash for optimistic locking to prevent conflicts'
          },
          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']
      }
    },
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it's a mutation operation (rename), it preserves filename/ID to maintain links, and it automatically updates wikilinks in other notes. However, it doesn't mention potential side effects like permission requirements, error conditions, or whether the operation is reversible.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise with just two sentences that each earn their place. The first sentence states the core functionality, and the second adds important behavioral context about link preservation and automatic updates. No wasted words, well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description does well by explaining the core behavior and side effects. However, it doesn't describe what the tool returns or potential error cases. Given the complexity of a rename operation with link updates, some additional context about return values would be helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is 3. The description adds some context about what 'identifier' represents and implies the purpose of 'new_title', but doesn't provide additional semantic meaning beyond what's already documented in the schema descriptions for each parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('rename a note by updating its title field') and distinguishes it from siblings like 'update_note' by specifying it only changes the display name while preserving filename/ID. It also mentions the automatic wikilink update feature, which is unique among sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (to rename a note's display title while preserving links), but doesn't explicitly state when NOT to use it or mention specific alternatives like 'update_note' for other modifications. It implies usage through the specific functionality described.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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