Skip to main content
Glama
glaucia86
by glaucia86

list_todos

Retrieve and filter tasks by status, priority, or tags with pagination controls to manage your todo list efficiently.

Instructions

List todos with filtering and pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusNoFilter by completion statusall
priorityNoFilter by priority
tagsNoFilter by tags (OR logic)
limitNoMaximum number of results
offsetNoNumber of results to skip

Implementation Reference

  • The handleListTodos method processes the 'list_todos' tool invocation: validates input using ListTodosSchema, delegates to TodoService.listTodos, and formats a paginated response with summary statistics.
    async handleListTodos(request: CallToolRequest): Promise<CallToolResult> {
      try {
        const sanitizedArgs = sanitizeInput(request.params.arguments);
        const validatedRequest = validateData(ListTodosSchema, sanitizedArgs);
        
        const result = this.todoService.listTodos({
          ...validatedRequest,
          status: validatedRequest.status || "all",
          limit: validatedRequest.limit || 50,
          offset: validatedRequest.offset || 0,
        });
    
        return {
          content: [
            {
              type: "text",
              text:
                `đź“‹ Encontrados ${result.todos.length} de ${result.total} todo(s)\n` +
                `📄 Página: ${Math.floor(result.offset / result.limit) + 1}\n` +
                `${
                  result.hasMore
                    ? "➡️ Há mais resultados disponíveis"
                    : "âś… Todos os resultados exibidos"
                }\n\n` +
                JSON.stringify(result.todos, null, 2),
            },
          ],
        };
      } catch (error) {
        const errorResponse = createErrorResponse(error, "listar todos");
        return {
          content: [
            {
              type: "text",
              text: `❌ ${errorResponse.error}\n${errorResponse.details || ""}`,
            },
          ],
        };
      }
    }
  • Zod schema defining input validation for list_todos tool parameters including status filter, priority, tags, limit, and offset.
    export const ListTodosSchema = z.object({
      status: z.enum(['all', 'completed', 'pending']).default('all'),
      priority: z.enum(['low', 'medium', 'high']).optional(),
      tags: z.array(z.string()).optional(),
      limit: z.number().int().min(1).max(100).default(50),
      offset: z.number().int().min(0).default(0)
    });
  • MCP tool definition entry for 'list_todos' including name, description, and JSON inputSchema used for tool registration.
    {
      name: "list_todos",
      description: "List todos with filtering and pagination",
      inputSchema: {
        type: "object",
        properties: {
          status: {
            type: "string",
            enum: ["all", "completed", "pending"],
            description: "Filter by completion status",
            default: "all",
          },
          priority: {
            type: "string",
            enum: ["low", "medium", "high"],
            description: "Filter by priority",
          },
          tags: {
            type: "array",
            items: { type: "string" },
            description: "Filter by tags (OR logic)",
          },
          limit: {
            type: "number",
            minimum: 1,
            maximum: 100,
            description: "Maximum number of results",
            default: 50,
          },
          offset: {
            type: "number",
            minimum: 0,
            description: "Number of results to skip",
            default: 0,
          },
        },
      },
    },
  • TodoService.listTodos implements the core filtering, pagination, and response formatting logic for listing todos based on input parameters.
    listTodos(request: ListTodosRequest): TodoListResponse {
      // Validar entrada
      const validatedRequest = validateData(ListTodosSchema, request);
      
      const filters: TodoFilters = {};
      
      if (validatedRequest.status !== undefined) {
        filters.status = validatedRequest.status;
      }
      
      if (validatedRequest.priority !== undefined) {
        filters.priority = validatedRequest.priority;
      }
      
      if (validatedRequest.tags !== undefined) {
        filters.tags = validatedRequest.tags;
      }
    
      const allFilteredTodos = this.getAllTodos(filters);
      const startIndex = validatedRequest.offset ?? 0;
      const limit = validatedRequest.limit ?? 50;
      const offset = validatedRequest.offset ?? 0;
      const endIndex = startIndex + limit;
      const paginatedTodos = allFilteredTodos.slice(startIndex, endIndex);
    
      const response: TodoListResponse = {
        todos: paginatedTodos,
        total: allFilteredTodos.length,
        limit: limit,
        offset: offset,
        hasMore: endIndex < allFilteredTodos.length
      };
    
      return validateData(TodoSchema.array(), paginatedTodos).length > 0 
        ? response 
        : { ...response, todos: [] };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'List todos' implies a read operation, the description doesn't address important behavioral aspects like whether this requires authentication, rate limits, what format the results come in, or how pagination works beyond mentioning it exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 6 words, front-loading the core purpose ('List todos') and efficiently mentioning key capabilities ('with filtering and pagination'). Every word earns its place with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the tool returns, how results are structured, or provide context about the filtering logic beyond what's in the schema. The agent would need to guess about the output format and behavioral characteristics.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the schema already documents all 5 parameters thoroughly. The description adds minimal value beyond confirming filtering and pagination capabilities, which the schema already details through parameter descriptions and enums. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List todos') and mentions key capabilities ('with filtering and pagination'), which provides a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from its sibling 'search_todos', which appears to be a similar listing/search tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'search_todos' or 'get_todo'. It mentions filtering capabilities but doesn't specify when this filtering approach is preferred over other tools in the server.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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