Skip to main content
Glama

bulk_delete_notes

Remove multiple notes from Flint Note by filtering with criteria like note type, tags, or content patterns. Use this tool to clean up your note vault efficiently.

Instructions

Delete multiple notes matching criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoFilter by note type
tagsNoFilter by tags (all tags must match)
patternNoRegex pattern to match note content or title
confirmNoExplicit confirmation required for bulk deletion

Implementation Reference

  • MCP tool handler for 'bulk_delete_notes'. Validates input, constructs deletion criteria from args, calls noteManager.bulkDeleteNotes, formats and returns results with success/failure summary.
    handleBulkDeleteNotes = async (args: BulkDeleteNotesArgs) => { // Validate arguments validateToolArgs('bulk_delete_notes', args); this.requireWorkspace(); try { const criteria = { type: args.type, tags: args.tags, pattern: args.pattern }; const results = await this.noteManager.bulkDeleteNotes(criteria, args.confirm); const resultsArray = results as Array<{ deleted: boolean }>; const successCount = resultsArray.filter(r => r.deleted).length; const failureCount = resultsArray.length - successCount; return { content: [ { type: 'text', text: JSON.stringify( { success: true, message: `Bulk delete completed: ${successCount} deleted, ${failureCount} failed`, results, summary: { total: resultsArray.length, successful: successCount, failed: failureCount } }, 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 }; } };
  • Core NoteManager.bulkDeleteNotes method implementing the bulk deletion logic: finds matching notes via criteria, enforces config limits and confirmation, deletes each via deleteNote, returns array of DeleteNoteResult.
    async bulkDeleteNotes( criteria: { type?: string; tags?: string[]; pattern?: string }, confirm: boolean = false ): Promise<DeleteNoteResult[]> { try { const config = this.#workspace.getConfig(); // Find notes matching criteria const matchingNotes = await this.findNotesMatchingCriteria(criteria); if (matchingNotes.length === 0) { return []; } // Check bulk delete limit if (matchingNotes.length > (config?.deletion?.max_bulk_delete || 10)) { throw new Error( `Bulk delete limit exceeded: attempting to delete ${matchingNotes.length} notes, ` + `maximum allowed is ${config?.deletion?.max_bulk_delete || 10}` ); } // Check confirmation requirement if (config?.deletion?.require_confirmation && !confirm) { throw new Error( `Bulk deletion of ${matchingNotes.length} notes requires confirmation. Set confirm=true to proceed.` ); } // Delete each note const results: DeleteNoteResult[] = []; for (const noteIdentifier of matchingNotes) { try { const result = await this.deleteNote(noteIdentifier, true); // Already confirmed at bulk level results.push(result); } catch (error) { // Continue with other deletions, but record the error results.push({ id: noteIdentifier, deleted: false, timestamp: new Date().toISOString(), warnings: [ `Failed to delete: ${error instanceof Error ? error.message : 'Unknown error'}` ] }); } } return results; } catch (error) { throw new Error( `Bulk delete failed: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • JSON schema definition for the 'bulk_delete_notes' tool, defining input parameters including type, tags, pattern, confirm, and vault_id.
    name: 'bulk_delete_notes', description: 'Delete multiple notes based on criteria', inputSchema: { type: 'object', properties: { type: { type: 'string', description: 'Delete all notes of this type' }, older_than_days: { type: 'number', description: 'Delete notes older than this many days' }, metadata_filter: { type: 'object', properties: { key: { type: 'string', description: 'Metadata key to filter on' }, value: { type: 'string', description: 'Value to match' }, operator: { type: 'string', enum: ['=', '!=', '>', '<', '>=', '<=', 'LIKE'], description: 'Comparison operator', default: '=' } }, required: ['key', 'value'] }, 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: ['confirm'] } },
  • TypeScript interface defining the input arguments for bulk_delete_notes tool.
    export interface BulkDeleteNotesArgs { type?: string; tags?: string[]; pattern?: 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