Skip to main content
Glama
danjdewhurst

Todo Markdown MCP Server

by danjdewhurst

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
NameRequiredDescriptionDefault
idYesThe todo item ID to delete

Implementation Reference

  • 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, }, },
  • TypeScript interface defining the DeleteTodoRequest input type with required 'id' field.
    export interface DeleteTodoRequest { id: string; }
  • 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`, }, ], }; }

Other Tools

Related 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/danjdewhurst/todo-md-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server