Skip to main content
Glama

get_next_task

Retrieve the next pending task from a request queue to continue workflow execution, displaying progress status and requiring approval before proceeding after task completion.

Instructions

Given a 'requestId', return the next pending task (not done yet). If all tasks are completed, it will indicate that no more tasks are left and that you must wait for the request completion approval.

A progress table showing the current status of all tasks will be displayed with each response.

If the same task is returned again or if no new task is provided after a task was marked as done but not yet approved, you MUST NOT proceed. In such a scenario, you must prompt the user for approval via 'approve_task_completion' before calling 'get_next_task' again. Do not skip the user's approval step. In other words:

  • After calling 'mark_task_done', do not call 'get_next_task' again until 'approve_task_completion' is called by the user.

  • If 'get_next_task' returns 'all_tasks_done', it means all tasks have been completed. At this point, you must not start a new request or do anything else until the user decides to 'approve_request_completion' or possibly add more tasks via 'request_planning'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestIdYes

Implementation Reference

  • The core handler function that implements the logic for getting the next pending task in a request, including status checks and progress table formatting.
    public async getNextTask(requestId: string) {
      const request = this.data.requests.find((r) => r.requestId === requestId);
      if (!request) {
        throw new Error("Request not found");
      }
    
      const nextTask = request.tasks.find((t) => !t.done);
      const allTasksDone = request.tasks.every((t) => t.approved);
    
      await this.saveTasks();
    
      if (allTasksDone) {
        return {
          message:
            "All tasks are done! Awaiting request completion approval.\n" +
            this.formatTaskProgressTable(requestId),
          taskId: null,
          allTasksDone: true,
        };
      }
    
      if (!nextTask) {
        return {
          message:
            "All tasks are done but some need approval.\n" +
            this.formatTaskProgressTable(requestId),
          taskId: null,
          allTasksDone: false,
        };
      }
    
      return {
        message:
          `Next task: ${nextTask.title}\n${nextTask.description}\n` +
          this.formatTaskProgressTable(requestId),
        taskId: nextTask.id,
        allTasksDone: false,
      };
    }
  • Zod schema defining the input structure for the get_next_task tool (requires requestId string).
    const GetNextTaskSchema = z.object({
      requestId: z.string(),
    });
  • index.ts:151-155 (registration)
    Registration of the get_next_task tool in the listTools() method, including name, description, and schema reference.
      name: "get_next_task",
      description: "Get the next pending task for a request.",
      inputSchema: GetNextTaskSchema,
    },
    {
  • Dispatcher handler in callTool() that validates input using the schema and delegates to the getNextTask method.
    case "get_next_task": {
      const parsed = GetNextTaskSchema.safeParse(parameters);
      if (!parsed.success) {
        throw new Error(`Invalid parameters: ${parsed.error}`);
      }
      return this.getNextTask(parsed.data.requestId);
    }
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behaviors: it returns a progress table with each response, indicates when no tasks are left, and specifies workflow constraints (e.g., not proceeding without user approval). However, it lacks details on error handling or rate limits.

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

Conciseness3/5

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

The description is front-loaded with the core purpose but becomes verbose with detailed workflow rules. While all information is relevant, it could be more streamlined. Sentences like 'In other words:' and the bulleted list add redundancy, reducing efficiency.

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 complexity of the workflow and lack of annotations or output schema, the description is mostly complete. It covers purpose, usage rules, and behavioral aspects, but does not detail the structure of the returned task or progress table, which could be helpful for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It explains that 'requestId' is used to identify which request's tasks to retrieve, adding meaning beyond the bare schema. However, it does not specify the format or source of 'requestId', leaving some ambiguity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Given a 'requestId', return the next pending task (not done yet).' It specifies the verb ('return'), resource ('next pending task'), and distinguishes it from siblings by focusing on sequential task retrieval rather than listing, adding, or modifying tasks.

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

Usage Guidelines5/5

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

The description provides explicit guidelines on when to use this tool vs. alternatives. It states not to call 'get_next_task' again until 'approve_task_completion' is called after 'mark_task_done', and to use 'approve_request_completion' or 'request_planning' when all tasks are done, clearly differentiating from sibling tools.

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/Rudra-ravi/mcp-taskmanager'

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