Skip to main content
Glama

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 {

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