Skip to main content
Glama

list-tasks

Retrieve and filter tasks by priority, context, project, or metadata using the tool. Organize and manage task lists efficiently within the MCP Todo.txt Integration server.

Instructions

List all tasks, optionally filtered by priority, context, project, or metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNo

Implementation Reference

  • src/tools.ts:109-148 (registration)
    Full registration of the 'list-tasks' tool, including name, description, input schema, and handler implementation.
    server.tool( "list-tasks", "List all tasks, optionally filtered by priority, context, project, or metadata.", { filter: z.object({ priority: z.string().optional(), context: z.string().optional(), project: z.string().optional(), extensions: z.record(z.string(), z.string()).optional(), }).optional(), }, async ({ filter }) => { const tasks = await loadTasks(); let filteredTasks = tasks; if (filter) { if (filter.priority) { filteredTasks = filteredTasks.filter(task => task.priority() === filter.priority); } if (filter.context) { filteredTasks = filteredTasks.filter(task => filter.context && task.contexts().includes(filter.context)); } if (filter.project) { filteredTasks = filteredTasks.filter(task => filter.project && task.projects().includes(filter.project)); } if (filter.extensions) { filteredTasks = filteredTasks.filter(task => { const extensions = task.extensions(); return Object.entries(filter.extensions || {}).every(([key, value]) => extensions.some(ext => ext.key === key && ext.value === value) ); }); } } return { content: [ { type: "text", text: filteredTasks.map(task => task.toString()).join("\n") }, ], }; } );
  • Handler function that loads tasks using loadTasks(), applies optional filters by priority, context, project, or extensions, and returns the filtered list as a markdown code block.
    async ({ filter }) => { const tasks = await loadTasks(); let filteredTasks = tasks; if (filter) { if (filter.priority) { filteredTasks = filteredTasks.filter(task => task.priority() === filter.priority); } if (filter.context) { filteredTasks = filteredTasks.filter(task => filter.context && task.contexts().includes(filter.context)); } if (filter.project) { filteredTasks = filteredTasks.filter(task => filter.project && task.projects().includes(filter.project)); } if (filter.extensions) { filteredTasks = filteredTasks.filter(task => { const extensions = task.extensions(); return Object.entries(filter.extensions || {}).every(([key, value]) => extensions.some(ext => ext.key === key && ext.value === value) ); }); } } return { content: [ { type: "text", text: filteredTasks.map(task => task.toString()).join("\n") }, ], }; }
  • Input schema defining an optional 'filter' object with fields for priority, context, project, and extensions using Zod validation.
    { filter: z.object({ priority: z.string().optional(), context: z.string().optional(), project: z.string().optional(), extensions: z.record(z.string(), z.string()).optional(), }).optional(), },

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/guifelix/mcp-server-todotxt'

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