Skip to main content
Glama

list_tasks

Create and manage structured task lists with status tracking, priorities, and dependencies. Organize tasks by status (pending, in progress, completed) to streamline workflows efficiently.

Instructions

Generate a structured task list, including complete status tracking, priority, and dependencies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYesTask status to list, can choose 'all' to list all tasks, or specify specific status

Implementation Reference

  • The main handler function for the 'list_tasks' tool. It fetches all tasks, filters them by the provided status ('all', 'pending', 'in_progress', or 'completed'), handles empty results, groups tasks by status, generates a prompt using getListTasksPrompt, and returns it as tool content.
    export async function listTasks({ status }: z.infer<typeof listTasksSchema>) { const tasks = await getAllTasks(); let filteredTasks = tasks; switch (status) { case "all": break; case "pending": filteredTasks = tasks.filter( (task) => task.status === TaskStatus.PENDING ); break; case "in_progress": filteredTasks = tasks.filter( (task) => task.status === TaskStatus.IN_PROGRESS ); break; case "completed": filteredTasks = tasks.filter( (task) => task.status === TaskStatus.COMPLETED ); break; } if (filteredTasks.length === 0) { return { content: [ { type: "text" as const, text: `## System Notification\n\nCurrently, there are no ${ status === "all" ? "any" : `any ${status} ` }tasks in the system. Please query other status tasks or first use the "split_tasks" tool to create task structure, then proceed with subsequent operations.`, }, ], }; } const tasksByStatus = tasks.reduce((acc, task) => { if (!acc[task.status]) { acc[task.status] = []; } acc[task.status].push(task); return acc; }, {} as Record<string, typeof tasks>); // Use prompt generator to get the final prompt const prompt = getListTasksPrompt({ status, tasks: tasksByStatus, allTasks: filteredTasks, }); return { content: [ { type: "text" as const, text: prompt, }, ], }; }
  • Zod schema defining the input for 'list_tasks': an object with 'status' field (enum: 'all', 'pending', 'in_progress', 'completed').
    export const listTasksSchema = z.object({ status: z .enum(["all", "pending", "in_progress", "completed"]) .describe("Task status to list, can choose 'all' to list all tasks, or specify specific status"), });
  • src/index.ts:256-260 (registration)
    Registration of the 'list_tasks' tool in the MCP server's ListToolsRequestHandler, providing name, description from template, and input schema converted to JSON schema.
    name: "list_tasks", description: loadPromptFromTemplate( "toolsDescription/listTasks.md" ), inputSchema: zodToJsonSchema(listTasksSchema),
  • src/index.ts:432-442 (registration)
    Handler registration for 'list_tasks' in the MCP server's CallToolRequestHandler: validates arguments with listTasksSchema, calls the listTasks function, and returns the result.
    case "list_tasks": parsedArgs = await listTasksSchema.safeParseAsync( request.params.arguments ); if (!parsedArgs.success) { throw new Error( `Invalid arguments for tool ${request.params.name}: ${parsedArgs.error.message}` ); } result = await listTasks(parsedArgs.data); return result;
  • Import of getListTasksPrompt helper used in the listTasks handler to generate the formatted prompt output.
    import { getPlanTaskPrompt, getAnalyzeTaskPrompt, getReflectTaskPrompt, getSplitTasksPrompt, getExecuteTaskPrompt, getVerifyTaskPrompt, getCompleteTaskPrompt, getListTasksPrompt,

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/liorfranko/mcp-chain-of-thought'

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