delete_todo
Remove a specific todo item by its ID from a markdown-based todo list using the Todo Markdown MCP Server.
Instructions
Delete a todo item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The todo item ID to delete |
Implementation Reference
- src/todoManager.ts:198-224 (handler)The core handler function in TodoManager class that deletes a todo item by ID. It loads todos, finds and removes the matching one, rewrites the markdown file.async deleteTodo(request: DeleteTodoRequest): Promise<void> { const todos = (await this.listTodos()).todos; const todoIndex = todos.findIndex((todo) => todo.id === request.id); if (todoIndex === -1) { throw new Error(`Todo with id ${request.id} not found`); } todos.splice(todoIndex, 1); const markdown = this.formatTodoMarkdown(todos); try { await writeFile(this.todoFilePath, markdown, 'utf-8'); } catch (error) { if (error instanceof Error && error.message.includes('EACCES')) { throw new Error( `Permission denied: Cannot write to ${this.todoFilePath}. Check file permissions or set TODO_FILE_PATH environment variable to a writable location.` ); } else if (error instanceof Error && error.message.includes('EROFS')) { throw new Error( `Read-only file system: Cannot write to ${this.todoFilePath}. Set TODO_FILE_PATH environment variable to a writable location.` ); } throw error; } }
- src/index.ts:87-101 (registration)Tool registration in the listTools response, defining name, description, and input schema for delete_todo.{ name: 'delete_todo', description: 'Delete a todo item', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'The todo item ID to delete', }, }, required: ['id'], additionalProperties: false, }, },
- src/types.ts:24-26 (schema)TypeScript interface defining the DeleteTodoRequest input type with required 'id' field.export interface DeleteTodoRequest { id: string; }
- src/index.ts:164-180 (handler)Dispatch handler in the main server that validates input, calls TodoManager.deleteTodo, and formats the response.case 'delete_todo': { const args = request.params .arguments as unknown as DeleteTodoRequest; if (!args?.id || typeof args.id !== 'string') { throw new Error('ID is required and must be a string'); } await this.todoManager.deleteTodo(args); return { content: [ { type: 'text', text: `Todo with ID ${args.id} deleted successfully`, }, ], }; }