Skip to main content
Glama

List Todos

list_todos
Read-onlyIdempotent

Retrieve and organize tasks with filtering by status, priority, tags, due dates, search queries, sorting, and pagination controls.

Instructions

List todos with filtering, search, sorting, and pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
completedNoFilter by completion status (deprecated; use status)
statusNoFilter by status
queryNoSearch text in title, description, or tags
priorityNoFilter by priority level
tagNoFilter by tag (must contain)
dueBeforeNoFilter todos due before this date (ISO format)
dueAfterNoFilter todos due after this date (ISO format)
sortByNoSort results by field
orderNoSort order (default: asc)
limitNoMax number of results to return (default: 50)
offsetNoNumber of results to skip

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
resultNo

Implementation Reference

  • Core handler function that normalizes filters, fetches todos from storage, computes counts, sorts and paginates them, and builds the response.
    async function handleListTodos(
      filters: ListTodosFilters
    ): Promise<CallToolResult> {
      const normalized = normalizeFilters(filters);
      const allTodos = await getTodos({
        completed: normalized.completed,
        priority: normalized.priority,
        tag: normalized.tag,
        dueBefore: normalized.dueBefore,
        dueAfter: normalized.dueAfter,
        query: normalized.query,
      });
    
      const todayIso = getTodayIso();
      const counts = computeCounts(allTodos, todayIso);
      const sorted = canReuseOrder(normalized.sortBy, normalized.order, counts)
        ? allTodos
        : sortTodos(allTodos, normalized.sortBy, normalized.order);
      const paged = paginateTodos(sorted, normalized.offset, normalized.limit);
      return buildListResponse(paged, counts, normalized);
    }
  • Input schema using Zod for validating filters like status, query, priority, pagination for the list_todos tool.
    export const ListTodosFilterSchema: ZodType<ListTodosFilterInput> =
      z.strictObject({
        completed: z
          .boolean()
          .optional()
          .describe('Filter by completion status (deprecated; use status)'),
        status: z
          .enum(['pending', 'completed', 'all'])
          .optional()
          .describe('Filter by status'),
        query: z
          .string()
          .min(1)
          .max(200)
          .optional()
          .describe('Search text in title, description, or tags'),
        priority: z
          .enum(['low', 'normal', 'high'])
          .optional()
          .describe('Filter by priority level'),
        tag: TagSchema.optional().describe('Filter by tag (must contain)'),
        dueBefore: IsoDateSchema.optional().describe(
          'Filter todos due before this date (ISO format)'
        ),
        dueAfter: IsoDateSchema.optional().describe(
          'Filter todos due after this date (ISO format)'
        ),
        sortBy: SortBySchema.optional().describe('Sort results by field'),
        order: SortOrderSchema.optional().describe('Sort order (default: asc)'),
        limit: z
          .int()
          .min(1)
          .max(200)
          .optional()
          .describe('Max number of results to return (default: 50)'),
        offset: z
          .int()
          .min(0)
          .max(10000)
          .optional()
          .describe('Number of results to skip'),
      });
  • Registers the 'list_todos' tool with the MCP server, specifying title, description, schemas, and the handler function.
    export function registerListTodos(server: McpServer): void {
      server.registerTool(
        'list_todos',
        {
          title: 'List Todos',
          description: 'List todos with filtering, search, sorting, and pagination',
          inputSchema: ListTodosFilterSchema,
          outputSchema: DefaultOutputSchema,
          annotations: {
            readOnlyHint: true,
            idempotentHint: true,
          },
        },
        async (filters) => {
          try {
            return await handleListTodos(filters);
          } catch (err) {
            return createErrorResponse('E_LIST_TODOS', getErrorMessage(err));
          }
        }
      );
    }
  • Top-level registration function that calls registerListTodos among others to set up all tools on the server.
    export function registerAllTools(server: McpServer): void {
      registerAddTodo(server);
      registerAddTodos(server);
      registerListTodos(server);
      registerUpdateTodo(server);
      registerCompleteTodo(server);
      registerDeleteTodo(server);
      registerDeleteTodos(server);
    }
Behavior3/5

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

Annotations declare readOnlyHint=true and idempotentHint=true, indicating safe, repeatable read operations. The description adds value by specifying capabilities like filtering and pagination, but does not disclose additional behavioral traits such as rate limits, authentication needs, or response format details. With annotations covering safety, a 3 is appropriate as the description adds some context without contradictions.

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 a single, efficient sentence that front-loads key information ('List todos') and succinctly lists capabilities. Every word earns its place, with no wasted text, making it highly concise and well-structured.

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

Completeness4/5

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

Given the tool's complexity (11 parameters) and rich annotations (readOnlyHint, idempotentHint) and output schema, the description is mostly complete. It covers core functionalities but lacks guidance on usage versus siblings. With output schema handling return values, the description's gaps are minor, warranting a 4.

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?

Schema description coverage is 100%, with detailed parameter descriptions in the input schema. The description mentions filtering, search, sorting, and pagination, which aligns with parameters but does not add significant meaning beyond the schema. Baseline 3 is correct when the schema fully documents parameters.

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 verb ('List') and resource ('todos'), and specifies the capabilities ('with filtering, search, sorting, and pagination'). However, it does not explicitly differentiate from sibling tools like 'add_todo' or 'complete_todo', which would require a 5. The purpose is clear but lacks sibling distinction.

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. It does not mention prerequisites, exclusions, or compare with sibling tools (e.g., 'add_todo' for creation, 'complete_todo' for updates). Usage is implied by the name 'list_todos', but no explicit context is given.

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/j0hanz/todokit-mcp-server'

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