remove_todo
Delete a specific todo item from your persistent list by providing its unique identifier to maintain an organized task management system.
Instructions
Remove a todo by id
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/server.ts:121-128 (handler)The handler function that implements the remove_todo tool logic: reads todos, filters out the one with matching ID, writes back if changed, and returns appropriate message.async ({ id }) => { const todos = await readTodos(); const next = todos.filter((t) => t.id !== id); if (next.length === todos.length) return { content: [{ type: "text", text: `No todo with id ${id}` }] }; await writeTodos(next); return { content: [{ type: "text", text: `Removed #${id}` }] }; }
- src/server.ts:116-120 (schema)Schema for the remove_todo tool: title, description, and input schema requiring a positive integer 'id'.{ title: "Remove Todo", description: "Remove a todo by id", inputSchema: { id: z.number().int().positive() }, },
- src/server.ts:114-129 (registration)Registration of the 'remove_todo' tool on the MCP server, including schema and handler.server.registerTool( "remove_todo", { title: "Remove Todo", description: "Remove a todo by id", inputSchema: { id: z.number().int().positive() }, }, async ({ id }) => { const todos = await readTodos(); const next = todos.filter((t) => t.id !== id); if (next.length === todos.length) return { content: [{ type: "text", text: `No todo with id ${id}` }] }; await writeTodos(next); return { content: [{ type: "text", text: `Removed #${id}` }] }; } );