Skip to main content
Glama

get_next_task

Retrieve the next pending task from TaskFlow MCP to manage workflow progression, displaying progress and requiring user approval between task completions.

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 ask the user what to do next.

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, you MUST NOT proceed. In such a scenario, you must prompt the user for approval 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 the user has given approval for the completed task.

  • If 'get_next_task' returns 'all_tasks_done', it means all tasks have been completed. At this point, confirm with the user that all tasks have been completed, and optionally add more tasks via 'add_tasks_to_request' or 'plan_task'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestIdYes

Implementation Reference

  • The MCP tool handler function for 'get_next_task', which delegates to the TaskFlowService's getNextTask method.
    async get_next_task(args: any) {
      return service.getNextTask(String(args.requestId));
    },
  • Registration of the 'get_next_task' tool (as GET_NEXT_TASK_TOOL) in the MCP server's ListTools response.
    tools: [
      PLAN_TASK_TOOL,
      GET_NEXT_TASK_TOOL,
      MARK_TASK_DONE_TOOL,
      OPEN_TASK_DETAILS_TOOL,
      LIST_REQUESTS_TOOL,
      ADD_TASKS_TO_REQUEST_TOOL,
      UPDATE_TASK_TOOL,
      DELETE_TASK_TOOL,
      ADD_SUBTASKS_TOOL,
      MARK_SUBTASK_DONE_TOOL,
      UPDATE_SUBTASK_TOOL,
      DELETE_SUBTASK_TOOL,
      EXPORT_TASK_STATUS_TOOL,
      ADD_NOTE_TOOL,
      UPDATE_NOTE_TOOL,
      DELETE_NOTE_TOOL,
      ADD_DEPENDENCY_TOOL,
      GET_PROMPTS_TOOL,
      SET_PROMPTS_TOOL,
      UPDATE_PROMPTS_TOOL,
      REMOVE_PROMPTS_TOOL,
      ARCHIVE_COMPLETED_REQUESTS_TOOL,
      LIST_ARCHIVED_REQUESTS_TOOL,
      RESTORE_ARCHIVED_REQUEST_TOOL,
    ],
  • Input schema definition for the 'get_next_task' tool.
      inputSchema: {
        type: "object",
        properties: {
          requestId: { type: "string" },
        },
        required: ["requestId"],
      },
    };
  • Core service method implementing the logic to retrieve the next pending task, generate progress table, and apply prompts.
    public async getNextTask(requestId: string) {
      await this.loadTasks();
      const req = this.getRequest(requestId);
      if (!req) return { status: "error", message: "Request not found" };
      if (req.completed) {
        return { status: "already_completed", message: "Request already completed." };
      }
    
      const nextTask = req.tasks.find((t) => !t.done);
      if (!nextTask) {
        const allDone = req.tasks.every((t) => t.done);
        if (allDone && !req.completed) {
          const progressTable = formatTaskProgressTableForRequest(req);
          return {
            status: "all_tasks_done",
            message: `All tasks have been completed. Awaiting completion approval.\n${progressTable}`,
          };
        }
        return { status: "no_next_task", message: "No undone tasks found." };
      }
    
      const progressTable = formatTaskProgressTableForRequest(req);
      const enhancedDescription = this.applyPromptsToTaskDescription(nextTask.description, this.data.prompts);
      
      return {
        status: "next_task",
        task: { 
          id: nextTask.id, 
          title: nextTask.title, 
          description: enhancedDescription,
          ...(this.data.prompts?.instructions && { instructions: this.data.prompts.instructions })
        },
        message: `Next task is ready. Task approval will be required after completion.\n${progressTable}`,
      };
    }
  • Zod/JSON schema definition for 'get_next_task' input validation (referenced but inline used in tool).
    get_next_task: {
      type: "object",
      properties: { requestId: { type: "string" } },
      required: ["requestId"],
    },
Behavior4/5

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

With no annotations provided, the description carries full burden and does so effectively. It discloses key behavioral traits: progress table display with each response, state-dependent outcomes (pending task vs. all_tasks_done), and critical workflow constraints (user approval requirements after task completion). It doesn't cover rate limits or error handling, but provides substantial operational context.

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 appropriately front-loaded with core functionality, but contains some redundancy (repeating approval requirements) and could be more streamlined. The bullet points help structure but add length. Most sentences earn their place, but some phrasing could be tighter.

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 tool's complexity (stateful workflow with user interactions) and absence of both annotations and output schema, the description provides substantial context about behavior, outcomes, and integration with sibling tools. It doesn't describe the progress table format or error cases, but covers the essential workflow comprehensively.

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?

Schema description coverage is 0% with 1 parameter, so the description must compensate. It explains that 'requestId' identifies which request's tasks to process, adding meaningful context beyond the bare schema. However, it doesn't specify format or constraints for the requestId value.

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 with specific verbs ('return the next pending task') and resource ('given a requestId'), distinguishing it from siblings like 'list_requests' or 'open_task_details'. It explicitly defines what constitutes a 'next task' (not done yet) versus completion state.

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 when-to-use guidance, including prerequisites (need 'requestId'), when not to use (after 'mark_task_done' without user approval), and alternatives for completion scenarios ('add_tasks_to_request' or 'plan_task'). It directly addresses sibling tool interactions with clear sequencing rules.

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/pinkpixel-dev/taskflow-mcp'

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