delete_todo
Remove a specific task from your todo list by providing its unique ID to manage your tasks effectively.
Instructions
Delete a todo item
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | UUID of the todo to delete |
Implementation Reference
- src/handlers/toolHandlers.ts:132-158 (handler)Main handler method for delete_todo tool. Validates input using DeleteTodoSchema, calls todoService.deleteTodo, and returns success/error response.async handleDeleteTodo(request: CallToolRequest): Promise<CallToolResult> { try { const sanitizedArgs = sanitizeInput(request.params.arguments); const validatedRequest = validateData(DeleteTodoSchema, sanitizedArgs); const deleted = this.todoService.deleteTodo(validatedRequest.id); return { content: [ { type: "text", text: deleted ? `✅ Todo com ID ${validatedRequest.id} deletado com sucesso` : `❌ Todo com ID ${validatedRequest.id} não encontrado`, }, ], }; } catch (error) { const errorResponse = createErrorResponse(error, "deletar todo"); return { content: [ { type: "text", text: `❌ ${errorResponse.error}\n${errorResponse.details || ""}`, }, ], }; }
- src/schemas/todo.schemas.ts:35-37 (schema)Zod schema defining input for delete_todo: requires 'id' field validated as UUID.export const DeleteTodoSchema = z.object({ id: UuiSchema });
- src/config/toolDefinitions.ts:77-91 (registration)Tool registration in TOOL_DEFINITIONS array, defining name, description, and input schema for MCP tool server.{ name: "delete_todo", description: "Delete a todo item", inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid", description: "UUID of the todo to delete", }, }, required: ["id"], }, },
- Core service method that performs the actual deletion from the in-memory todos Map after validating ID.deleteTodo(id: string): boolean { try { validateData(TodoSchema.shape.id, id); return this.todos.delete(id); } catch (error) { if (error instanceof ValidationError) { throw error; } return false; } }