Skip to main content
Glama
glaucia86
by glaucia86

get_todo

Retrieve a specific task by its unique ID to view details, update status, or manage priorities within your todo list.

Instructions

Get a specific todo by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUUID of the todo to retrieve

Implementation Reference

  • Handler function that executes the 'get_todo' tool: sanitizes and validates input using GetTodoByIdSchema, retrieves todo via service, formats success/error response.
    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 || ""}`,
            },
          ],
        };
      }
    }
  • Zod input schema for validating the 'get_todo' tool request: requires a valid UUID id.
    export const GetTodoByIdSchema = z.object({
      id: UuiSchema
    });
  • MCP tool registration definition for 'get_todo', including JSON input schema for UUID id.
    {
      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"],
      },
    },
  • Core service method that fetches a todo item by ID from the in-memory todos Map.
    getTodoById(id: string): Todo | null {
      const todo = this.todos.get(id);
      return todo || null;
    }

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