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
    }
Behavior3/5

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

With no annotations, the description carries full burden. It discloses that tasks include 'tool and rule recommendations,' which adds behavioral context beyond basic listing. However, it doesn't mention pagination, sorting, rate limits, permissions, or response format. For a list operation with zero annotation coverage, this leaves gaps in understanding how the tool behaves.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the core functionality (listing tasks with filters) and adds a useful detail about task content. There's no wasted text, but it could be slightly more structured (e.g., separating filtering from content notes).

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

Completeness3/5

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

Given no annotations and no output schema, the description is moderately complete for a simple list tool. It covers purpose and filtering, and adds context about task recommendations. However, it lacks details on response structure, error handling, or operational constraints, which are important for an agent to use it effectively without structured output guidance.

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%, so the schema fully documents both parameters. The description adds marginal value by summarizing the filtering options ('optionally filtered by project ID and/or state') and listing state values, but doesn't provide additional syntax, format, or examples beyond what the schema already states. Baseline 3 is appropriate when schema does the heavy lifting.

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 'tasks', specifying optional filtering by project ID and state. It distinguishes from siblings like 'get_next_task' (single task) and 'read_task' (single task by ID), but doesn't explicitly contrast with 'list_projects' or other list operations. The mention of tool/rule recommendations adds useful context about task content.

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

Usage Guidelines3/5

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

The description implies usage through the filtering parameters (project ID, state), suggesting when to apply filters. However, it doesn't explicitly state when to use this tool versus alternatives like 'get_next_task' (for workflow) or 'list_projects' (for project overview). No guidance on prerequisites or exclusions is provided.

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

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