Skip to main content
Glama
bazylhorsey
by bazylhorsey

delete_note

Remove notes from Obsidian vaults to maintain organized knowledge bases and eliminate outdated information.

Instructions

Delete a note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the note
vaultYesVault name

Implementation Reference

  • 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) }],
      };
    }
  • 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>>;

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