Skip to main content
Glama

delete_note

Remove unwanted notes permanently from your Flint Note vault to maintain organized, clutter-free documentation. This tool requires explicit confirmation before deletion.

Instructions

Delete an existing note permanently

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesNote identifier (type/filename format)
confirmNoExplicit confirmation required for deletion
vault_idNoOptional vault ID to operate on. If not provided, uses the current active vault.

Implementation Reference

  • MCP tool handler implementation for 'delete_note'. Validates arguments using validateToolArgs('delete_note', args), resolves vault context, calls noteManager.deleteNote(identifier, confirm), and returns formatted success/error response.
    handleDeleteNote = async (args: DeleteNoteArgs) => { try { // Validate arguments validateToolArgs('delete_note', args); const { noteManager } = await this.resolveVaultContext(args.vault_id); const result = await noteManager.deleteNote(args.identifier, args.confirm); return { content: [ { type: 'text', text: JSON.stringify( { success: true, message: `Note '${args.identifier}' deleted successfully`, 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 }; } };
  • Input schema definition for the 'delete_note' tool, specifying parameters: identifier (required string), confirm (boolean, default false), vault_id (optional string).
    name: 'delete_note', description: 'Delete a specific note', inputSchema: { type: 'object', properties: { identifier: { type: 'string', description: 'Note identifier in type/filename format' }, confirm: { type: 'boolean', description: 'Confirmation flag to prevent accidental deletion', default: false }, vault_id: { type: 'string', description: 'Optional vault ID to operate on. If not provided, uses the current active vault.' } }, required: ['identifier', 'confirm'] }
  • Registration of 'delete_note' tool in MCP CallToolRequestSchema handler, dispatching to noteHandlers.handleDeleteNote
    return await this.noteHandlers.handleDeleteNote( args as unknown as DeleteNoteArgs );
  • Core NoteManager.deleteNote method implementing the file deletion logic: validates deletion safety, checks config/confirmation, creates backup if enabled, removes from search index, unlinks the file, returns DeleteNoteResult.
    async deleteNote( identifier: string, confirm: boolean = false ): Promise<DeleteNoteResult> { try { const config = this.#workspace.getConfig(); // Validate deletion const validation = await this.validateNoteDeletion(identifier); if (!validation.can_delete) { throw new Error(`Cannot delete note: ${validation.errors.join(', ')}`); } // Check confirmation requirement if (config?.deletion?.require_confirmation && !confirm) { throw new Error(`Deletion requires confirmation. Set confirm=true to proceed.`); } const { typeName: _typeName, filename: _filename, notePath } = this.parseNoteIdentifier(identifier); let backupPath: string | undefined; // Create backup if enabled if (config?.deletion?.create_backups) { const backup = await this.createNoteBackup(notePath); backupPath = backup.path; } // Remove from search index first await this.removeFromSearchIndex(notePath); // Delete the file await fs.unlink(notePath); return { id: identifier, deleted: true, timestamp: new Date().toISOString(), backup_path: backupPath, warnings: validation.warnings }; } catch (error) { const errorMessage = error instanceof Error ? error.message : 'Unknown error'; throw new Error(`Failed to delete note '${identifier}': ${errorMessage}`); } }
  • TypeScript interface DeleteNoteArgs defining the input parameters for the delete_note tool.
    export interface DeleteNoteArgs { identifier: string; confirm?: boolean; vault_id?: string; }

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