Skip to main content
Glama

delete_todo

Remove a specific task from your Todo List MCP Server by providing its unique UUID, ensuring efficient task management and organization.

Instructions

Delete a todo item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUUID of the todo to delete

Implementation Reference

  • The main handler function for the 'delete_todo' tool. Validates input using DeleteTodoSchema, calls todoService.deleteTodo, and returns success or 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 || ""}`, }, ], }; } }
  • Zod schema for validating the input parameters of the delete_todo tool (requires 'id' as UUID). Used in the handler for validation.
    export const DeleteTodoSchema = z.object({ id: UuiSchema });
  • Tool registration in the TOOL_DEFINITIONS array, defining name, description, and input schema for MCP server advertisement.
    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 UUID validation.
    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; } }

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/glaucia86/todo-list-mcp-server'

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