Skip to main content
Glama

list_tasks

Retrieve and filter tasks by project ID or state (open, pending_approval, completed, all) for structured task management. Includes recommendations to guide task completion.

Instructions

List all tasks, optionally filtered by project ID and/or state (open, pending_approval, completed, all). Tasks may include tool and rule recommendations to guide their completion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID of the project to list tasks from. If omitted, list all tasks.
stateNoFilter tasks by state. 'open' (not started/in progress), 'pending_approval', 'completed', or 'all' to skip filtering.

Implementation Reference

  • The ToolExecutor for 'list_tasks': validates optional projectId and state args, delegates to TaskManager.listTasks(), and registers in toolExecutorMap.
    const listTasksToolExecutor: ToolExecutor = { name: "list_tasks", async execute(taskManager, args) { // 1. Argument Validation const projectId = args.projectId !== undefined ? validateProjectId(args.projectId) : undefined; const state = validateOptionalStateParam(args.state, [ "open", "pending_approval", "completed", "all", ]); // 2. Core Logic Execution const resultData = await taskManager.listTasks(projectId, state as any); // 3. Return raw success data return resultData; }, }; toolExecutorMap.set(listTasksToolExecutor.name, listTasksToolExecutor);
  • MCP Tool definition for 'list_tasks' including input schema (optional projectId, state with enum).
    const listTasksTool: Tool = { name: "list_tasks", description: "List all tasks, optionally filtered by project ID and/or state (open, pending_approval, completed, all). Tasks may include tool and rule recommendations to guide their completion.", inputSchema: { type: "object", properties: { projectId: { type: "string", description: "The ID of the project to list tasks from. If omitted, list all tasks.", }, state: { type: "string", enum: ["open", "pending_approval", "completed", "all"], description: "Filter tasks by state. 'open' (not started/in progress), 'pending_approval', 'completed', or 'all' to skip filtering.", }, }, required: [], // Neither projectId nor state is required, both are optional filters }, };
  • Registers all tools (including 'list_tasks' via ALL_TOOLS) for MCP listTools request.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: ALL_TOOLS }; });
  • Core implementation in TaskManager that retrieves, filters (by project/state), and returns list of tasks.
    public async listTasks(projectId?: string, state?: TaskState): Promise<ListTasksSuccessData> { await this.ensureInitialized(); await this.reloadFromDisk(); if (state && !["all", "open", "completed", "pending_approval"].includes(state)) { throw new AppError(`Invalid state filter: ${state}`, AppErrorCode.InvalidState); } let allTasks: Task[] = []; if (projectId) { const proj = this.data.projects.find((p) => p.projectId === projectId); if (!proj) { throw new AppError(`Project ${projectId} not found`, AppErrorCode.ProjectNotFound); } allTasks = [...proj.tasks]; } else { // Collect tasks from all projects allTasks = this.data.projects.flatMap((p) => p.tasks); } if (state && state !== "all") { allTasks = allTasks.filter((task) => { switch (state) { case "open": return !task.approved; case "completed": return task.status === "done" && task.approved; case "pending_approval": return task.status === "done" && !task.approved; default: return true; } }); } return { message: `Tasks in the system${projectId ? ` for project ${projectId}` : ""}:\n${allTasks.length} tasks found.`, tasks: allTasks, }; }
  • Type definition for the output data structure of list_tasks.
    export interface ListTasksSuccessData { message: string; tasks: Task[]; // Use the full Task type }

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/chriscarrollsmith/taskqueue-mcp'

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