get_todo
Retrieve a specific task by its unique ID using the tool on Todo List MCP Server. Input the task's UUID to access its details efficiently.
Instructions
Get a specific todo by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | UUID of the todo to retrieve |
Implementation Reference
- src/handlers/toolHandlers.ts:202-238 (handler)The handleGetTodo function implements the get_todo tool logic: validates the input ID using GetTodoByIdSchema, fetches the todo using TodoService, and returns formatted text response or error.async handleGetTodo(request: CallToolRequest): Promise<CallToolResult> { try { const sanitizedArgs = sanitizeInput(request.params.arguments); const validatedRequest = validateData(GetTodoByIdSchema, sanitizedArgs); const todo = this.todoService.getTodoById(validatedRequest.id); if (!todo) { return { content: [ { type: "text", text: `❌ Todo com ID ${validatedRequest.id} não encontrado`, }, ], }; } return { content: [ { type: "text", text: `📋 Todo encontrado:\n\n${JSON.stringify(todo, null, 2)}`, }, ], }; } catch (error) { const errorResponse = createErrorResponse(error, "buscar todo"); return { content: [ { type: "text", text: `❌ ${errorResponse.error}\n${errorResponse.details || ""}`, }, ], }; } }
- src/config/toolDefinitions.ts:130-144 (registration)The tool definition for 'get_todo' including name, description, and input schema for registration in the TOOL_DEFINITIONS array.{ name: "get_todo", description: "Get a specific todo by ID", inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid", description: "UUID of the todo to retrieve", }, }, required: ["id"], }, },
- src/schemas/todo.schemas.ts:47-49 (schema)Zod schema for validating the input to get_todo tool, requiring a UUID id.export const GetTodoByIdSchema = z.object({ id: UuiSchema });
- The TodoService method getTodoById that retrieves a todo from the in-memory store by ID, called by the handler.getTodoById(id: string): Todo | null { const todo = this.todos.get(id); return todo || null; }