delete_todo
Permanently delete entire TODO lists and associated tasks from the Knowledge MCP Server. Use this tool to clean up completed, obsolete, or duplicate TODOs, ensuring project organization. Confirms permanent removal upon execution.
Instructions
Delete an entire TODO list and all its tasks permanently.
When to use this tool:
TODO is completely finished
TODO is obsolete or cancelled
Cleaning up old TODOs
Consolidating duplicate TODOs
User explicitly requests deletion
Key features:
Removes entire TODO list
Deletes all associated tasks
Permanent removal
Frees up TODO number
You should:
Verify all tasks are complete or obsolete
Confirm TODO number is correct
Understand deletion is permanent
Consider if TODO has value for history
Check no active work depends on it
DO NOT use when:
TODO has incomplete relevant tasks
Might need TODO for reference
Unsure about deletion impact
Returns: {success: bool, message: str, error?: str}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project identifier | |
| todo_number | Yes | The TODO list number to delete |
Implementation Reference
- The primary asynchronous handler function implementing the delete_todo tool. It validates parameters, checks for project and TODO existence, recursively deletes the TODO directory using fs.rm, performs a git auto-commit, and returns a success/error response.async deleteTodoAsync(params: { project_id: z.infer<typeof secureProjectIdSchema>; todo_number: z.infer<typeof secureTodoNumberSchema>; }): Promise<string> { const context = this.createContext('delete_todo', params); try { const { project_id, todo_number } = params; const projectInfo = await getProjectDirectoryAsync(this.storagePath, project_id); if (!projectInfo) { throw new MCPError(MCPErrorCode.PROJECT_NOT_FOUND, `Project ${project_id} not found`, { project_id, traceId: context.traceId, }); } const [originalId, projectPath] = projectInfo; const todoDir = join(projectPath, 'TODO', todo_number.toString()); // Check if TODO exists try { await access(todoDir); } catch { throw new MCPError(MCPErrorCode.TODO_NOT_FOUND, `TODO #${todo_number} not found`, { project_id, todo_number, traceId: context.traceId, }); } // Delete the entire TODO directory await rm(todoDir, { recursive: true, force: true }); // Auto-commit await autoCommitAsync(this.storagePath, `Delete TODO #${todo_number} from ${originalId}`); this.logSuccess('delete_todo', params, context); return this.formatSuccessResponse({ message: `Deleted TODO #${todo_number}`, }); } catch (error) { this.logError('delete_todo', params, error as MCPError, context); return this.formatErrorResponse(error, context); } }
- src/knowledge-mcp/server.ts:786-806 (registration)Registers the 'delete_todo' tool with the MCP server, defining its title, description from toolDescriptions, input schema using Zod schemas, and handler delegation to todoHandler.deleteTodoAsync.'delete_todo', { title: 'Delete TODO', description: TOOL_DESCRIPTIONS.delete_todo, inputSchema: { project_id: secureProjectIdSchema.describe('The project identifier'), todo_number: secureTodoNumberSchema.describe('The TODO list number to delete'), }, }, async ({ project_id, todo_number }) => { const result = await todoHandler.deleteTodoAsync({ project_id, todo_number }); return { content: [ { type: 'text', text: result, }, ], }; } );
- Detailed usage description and guidelines for the delete_todo tool, used in tool registration.delete_todo: `Delete an entire TODO list and all its tasks permanently. When to use this tool: - TODO is completely finished - TODO is obsolete or cancelled - Cleaning up old TODOs - Consolidating duplicate TODOs - User explicitly requests deletion Key features: - Removes entire TODO list - Deletes all associated tasks - Permanent removal - Frees up TODO number You should: 1. Verify all tasks are complete or obsolete 2. Confirm TODO number is correct 3. Understand deletion is permanent 4. Consider if TODO has value for history 5. Check no active work depends on it DO NOT use when: - TODO has incomplete relevant tasks - Might need TODO for reference - Unsure about deletion impact Returns: {success: bool, message: str, error?: str}`,