delete_note
Remove notes from Obsidian vaults to maintain organized knowledge bases and eliminate outdated information.
Instructions
Delete a note
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the note | |
| vault | Yes | Vault name |
Implementation Reference
- src/index.ts:532-541 (handler)MCP tool handler for 'delete_note': retrieves the vault connector and calls its deleteNote method with the provided path.case 'delete_note': { const connector = this.connectors.get(args?.vault as string); if (!connector) { throw new Error(`Vault "${args?.vault}" not found`); } const result = await connector.deleteNote(args?.path as string); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:121-132 (schema)Input schema definition and registration for the 'delete_note' tool in the ListTools response.{ name: 'delete_note', description: 'Delete a note', inputSchema: { type: 'object', properties: { vault: { type: 'string', description: 'Vault name' }, path: { type: 'string', description: 'Path to the note' }, }, required: ['vault', 'path'], }, },
- deleteNote implementation for remote vaults: sends DELETE request to the remote API endpoint.async deleteNote(path: string): Promise<VaultOperationResult<void>> { try { await this.client.delete(`/vault/${encodeURIComponent(path)}`); this.notesCache.delete(path); return { success: true }; } catch (error) { return { success: false, error: `Failed to delete note: ${error instanceof Error ? error.message : String(error)}` }; }
- deleteNote implementation for local vaults: deletes the file using fs.unlink and updates cache.async deleteNote(notePath: string): Promise<VaultOperationResult<void>> { try { const fullPath = path.join(this.config.path!, notePath); await fs.unlink(fullPath); this.notesCache.delete(notePath); return { success: true }; } catch (error) { return { success: false, error: `Failed to delete note: ${error instanceof Error ? error.message : String(error)}` }; }
- Abstract method definition in BaseConnector interface that all connectors must implement.abstract deleteNote(path: string): Promise<VaultOperationResult<void>>;