Skip to main content
Glama
disnet
by disnet

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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose critical traits like whether deletions are permanent/irreversible, require specific permissions, have rate limits, or provide confirmation feedback. For a destructive bulk operation, this lack of transparency is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It front-loads the core action ('Delete multiple notes') and immediately clarifies the scope ('matching criteria'), making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive bulk operation with no annotations and no output schema, the description is inadequate. It lacks context on safety (e.g., confirmation workflow), side effects, error handling, or return values. Given the complexity and risk, more completeness is needed to guide safe usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are fully documented in the schema. The description adds no additional meaning about parameters beyond implying they define 'criteria' for filtering. This meets the baseline for high schema coverage but doesn't enhance understanding (e.g., explaining how criteria combine).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete multiple notes') and the scope ('matching criteria'), which distinguishes it from the sibling 'delete_note' that likely handles single deletions. However, it doesn't specify what constitutes 'multiple' (e.g., all matching vs. batch limits) or mention the resource type (e.g., Obsidian notes), making it slightly less specific than ideal.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'delete_note' for single deletions or 'search_notes' for previewing matches. The description implies it's for bulk operations but doesn't clarify prerequisites (e.g., needing to confirm matches first) or exclusions (e.g., not for archived notes).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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