Skip to main content
Glama
disnet
by disnet

delete_note_type

Remove a note type from Flint Note and specify how to handle existing notes: prevent deletion, migrate to another type, or delete all notes.

Instructions

Delete a note type and optionally handle existing notes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
type_nameYesName of the note type to delete
actionYesAction to take with existing notes: error (prevent deletion), migrate (move to target type), delete (remove all notes)
target_typeNoTarget note type for migration (required when action is migrate)
confirmNoExplicit confirmation required for deletion

Implementation Reference

  • MCP tool handler for 'delete_note_type'. Validates input, requires workspace, calls NoteTypeManager.deleteNoteType, and formats success/error response.
    handleDeleteNoteType = async (args: DeleteNoteTypeArgs) => {
      // Validate arguments
      validateToolArgs('delete_note_type', args);
    
      this.requireWorkspace();
    
      try {
        const result = await this.noteTypeManager.deleteNoteType(
          args.type_name,
          args.action,
          args.target_type,
          args.confirm
        );
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: true,
                  message: `Note type '${args.type_name}' 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_type' MCP tool, including parameters like type_name, migration_strategy, target_type, confirm, and vault_id.
      name: 'delete_note_type',
      description: 'Delete a note type and optionally migrate notes',
      inputSchema: {
        type: 'object',
        properties: {
          type_name: {
            type: 'string',
            description: 'Name of the note type to delete'
          },
          migration_strategy: {
            type: 'string',
            enum: ['delete_notes', 'migrate_to_type'],
            description: 'What to do with existing notes of this type'
          },
          target_type: {
            type: 'string',
            description:
              'Target type for migration (required if migration_strategy is migrate_to_type)'
          },
          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: ['type_name', 'migration_strategy', 'confirm']
      }
    },
  • Core NoteTypeManager.deleteNoteType method implementing the deletion logic: validates action, handles note migration or deletion, creates backups if configured, and removes the note type directory.
    async deleteNoteType(
      typeName: string,
      action: DeletionAction = 'error',
      targetType?: string,
      confirm: boolean = false
    ): Promise<NoteTypeDeleteResult> {
      try {
        const config = this.workspace.getConfig();
    
        // Check if note type deletion is allowed
        if (!config?.deletion?.allow_note_type_deletion) {
          throw new Error('Note type deletion is disabled in configuration');
        }
    
        // Validate deletion
        const validation = await this.validateNoteTypeDeletion(
          typeName,
          action,
          targetType
        );
        if (!validation.can_delete) {
          throw new Error(`Cannot delete note type: ${validation.errors.join(', ')}`);
        }
    
        // Check confirmation requirement
        if (config?.deletion?.require_confirmation && !confirm) {
          throw new Error(
            `Note type deletion requires confirmation. Set confirm=true to proceed.`
          );
        }
    
        const typePath = this.workspace.getNoteTypePath(typeName);
        const notes = await this.getNotesInType(typeName);
        let backupPath: string | undefined;
    
        // Create backup if enabled
        if (config?.deletion?.create_backups && notes.length > 0) {
          const backup = await this.createNoteTypeBackup(typeName, notes);
          backupPath = backup.path;
        }
    
        // Execute the deletion action
        let migrationTarget: string | undefined;
        switch (action) {
          case 'error':
            if (notes.length > 0) {
              throw new Error(
                `Cannot delete note type '${typeName}': contains ${notes.length} notes`
              );
            }
            break;
    
          case 'migrate':
            if (!targetType) {
              throw new Error('Migration target type is required for migrate action');
            }
            migrationTarget = targetType;
            await this.migrateNotesToType(notes, targetType);
            break;
    
          case 'delete':
            // Check bulk delete limit
            if (notes.length > (config?.deletion?.max_bulk_delete || 10)) {
              throw new Error(
                `Cannot delete ${notes.length} notes: exceeds bulk delete limit of ${config?.deletion?.max_bulk_delete || 10}`
              );
            }
            await this.deleteNotesInType(notes);
            break;
        }
    
        // Remove the directory and all its contents
        await fs.rm(typePath, { recursive: true, force: true });
    
        return {
          name: typeName,
          deleted: true,
          timestamp: new Date().toISOString(),
          action,
          notes_affected: notes.length,
          backup_path: backupPath,
          migration_target: migrationTarget
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        throw new Error(`Failed to delete note type '${typeName}': ${errorMessage}`);
      }
    }
  • TypeScript interface defining the arguments for delete_note_type tool.
    export interface DeleteNoteTypeArgs {
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that deletion can optionally handle existing notes, hinting at destructive behavior, but fails to specify critical details like permissions required, whether the action is reversible, error handling for invalid inputs, or what happens to associated data beyond notes. This is inadequate for a mutation tool with potential data loss.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core action ('Delete a note type') and adds a useful qualifier ('and optionally handle existing notes'). There's no wasted verbiage, though it could be slightly more structured by separating key points.

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?

Given the tool's complexity (a destructive mutation with 4 parameters and no output schema) and lack of annotations, the description is insufficient. It doesn't cover behavioral nuances like confirmation requirements, migration specifics, or error scenarios, leaving significant gaps for an agent to operate safely and effectively.

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 the schema fully documents all parameters. The description adds minimal value by implying the 'action' parameter relates to handling existing notes, but it doesn't explain the semantics or consequences of choices like 'migrate' versus 'delete' beyond what's in the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 a note type') and resource ('note type'), which is specific and unambiguous. However, it doesn't explicitly distinguish this tool from sibling tools like 'delete_note' or 'bulk_delete_notes' beyond mentioning 'note type' versus 'note'.

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?

The description provides no guidance on when to use this tool versus alternatives such as 'delete_note' or 'bulk_delete_notes'. It mentions handling existing notes but doesn't clarify prerequisites, dependencies, or typical use cases, leaving the agent to infer usage from context alone.

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