Skip to main content
Glama

update_note

Modify existing notes in Obsidian vaults by updating content and metadata to maintain current information and organized knowledge management.

Instructions

Update an existing note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesNew content
frontmatterNoUpdated frontmatter
pathYesPath to the note
vaultYesVault name

Implementation Reference

  • src/index.ts:107-120 (registration)
    Registration of the 'update_note' tool including name, description, and input schema definition.
    { name: 'update_note', description: 'Update an existing note', inputSchema: { type: 'object', properties: { vault: { type: 'string', description: 'Vault name' }, path: { type: 'string', description: 'Path to the note' }, content: { type: 'string', description: 'New content' }, frontmatter: { type: 'object', description: 'Updated frontmatter' }, }, required: ['vault', 'path', 'content'], }, },
  • Primary handler for the 'update_note' tool call, which retrieves the vault connector by name and delegates the update operation to it.
    case 'update_note': { const connector = this.connectors.get(args?.vault as string); if (!connector) { throw new Error(`Vault "${args?.vault}" not found`); } const result = await connector.updateNote(args?.path as string, args?.content as string, args?.frontmatter as Record<string, any> | undefined); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • Implementation of updateNote for local file system vaults: serializes note content with frontmatter and writes to filesystem.
    async updateNote(notePath: string, content: string, frontmatter?: Record<string, any>): Promise<VaultOperationResult<Note>> { try { const fullPath = path.join(this.config.path!, notePath); const note: Note = { path: notePath, title: frontmatter?.title || notePath.split('/').pop()?.replace('.md', '') || 'Untitled', content, frontmatter }; const serialized = serializeNote(note); await fs.writeFile(fullPath, serialized, 'utf-8'); // Parse the note to get full structure const result = await this.getNote(notePath); return result; } catch (error) { return { success: false, error: `Failed to update note: ${error instanceof Error ? error.message : String(error)}` }; } }
  • Implementation of updateNote for remote vaults: sends PUT request to remote API with serialized note content.
    async updateNote(path: string, content: string, frontmatter?: Record<string, any>): Promise<VaultOperationResult<Note>> { try { const note: Note = { path, title: frontmatter?.title || path.split('/').pop()?.replace('.md', '') || 'Untitled', content, frontmatter }; const serialized = serializeNote(note); await this.client.put(`/vault/${encodeURIComponent(path)}`, { content: serialized }); // Clear cache and refetch this.notesCache.delete(path); const result = await this.getNote(path); return result; } catch (error) { return { success: false, error: `Failed to update note: ${error instanceof Error ? error.message : String(error)}` }; } }
  • Abstract method definition in base connector interface that concrete implementations must provide.
    * Update an existing note */ abstract updateNote(path: string, content: string, frontmatter?: Record<string, any>): Promise<VaultOperationResult<Note>>;

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/bazylhorsey/obsidian-mcp-server'

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