Skip to main content
Glama
kazuph

@kazuph/mcp-taskmanager

by kazuph

get_next_task

Retrieve the next pending task for a given request ID, display task progress, and ensure user approval before proceeding. Prevents task execution without explicit completion approval.

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

  • Executes the core logic of the 'get_next_task' tool: loads tasks from file, finds the next undone task for the given requestId, handles edge cases (request not found, completed, all tasks done), generates a progress table using helper method, and returns structured response with status, task details, and message.
    public async getNextTask(requestId: string) {
      await this.loadTasks();
      const req = this.data.requests.find((r) => r.requestId === 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) {
        // all tasks done?
        const allDone = req.tasks.every((t) => t.done);
        if (allDone && !req.completed) {
          const progressTable = this.formatTaskProgressTable(requestId);
          return {
            status: "all_tasks_done",
            message: `All tasks have been completed. Awaiting request completion approval.\n${progressTable}`,
          };
        }
        return { status: "no_next_task", message: "No undone tasks found." };
      }
    
      const progressTable = this.formatTaskProgressTable(requestId);
      return {
        status: "next_task",
        task: {
          id: nextTask.id,
          title: nextTask.title,
          description: nextTask.description,
        },
        message: `Next task is ready. Task approval will be required after completion.\n${progressTable}`,
      };
    }
  • Zod schema for input validation of 'get_next_task' tool, requiring a 'requestId' string.
    const GetNextTaskSchema = z.object({
      requestId: z.string(),
    });
  • index.ts:136-152 (registration)
    MCP Tool object definition for 'get_next_task', including name, detailed usage description, and JSON input schema.
    const GET_NEXT_TASK_TOOL: Tool = {
      name: "get_next_task",
      description:
        "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.\n\n" +
        "A progress table showing the current status of all tasks will be displayed with each response.\n\n" +
        "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.\n" +
        "In other words:\n" +
        "- After calling 'mark_task_done', do not call 'get_next_task' again until 'approve_task_completion' is called by the user.\n" +
        "- 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'.",
      inputSchema: {
        type: "object",
        properties: {
          requestId: { type: "string" },
        },
        required: ["requestId"],
      },
    };
  • index.ts:683-696 (registration)
    Registers all tools including 'get_next_task' (via GET_NEXT_TASK_TOOL) in the MCP listTools handler response.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        REQUEST_PLANNING_TOOL,
        GET_NEXT_TASK_TOOL,
        MARK_TASK_DONE_TOOL,
        APPROVE_TASK_COMPLETION_TOOL,
        APPROVE_REQUEST_COMPLETION_TOOL,
        OPEN_TASK_DETAILS_TOOL,
        LIST_REQUESTS_TOOL,
        ADD_TASKS_TO_REQUEST_TOOL,
        UPDATE_TASK_TOOL,
        DELETE_TASK_TOOL,
      ],
    }));
  • index.ts:719-730 (registration)
    MCP CallToolRequest handler case for 'get_next_task': validates input using GetNextTaskSchema, calls TaskManagerServer.getNextTask, and formats response.
    case "get_next_task": {
      const parsed = GetNextTaskSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments: ${parsed.error}`);
      }
      const result = await taskManagerServer.getNextTask(
        parsed.data.requestId
      );
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses key behaviors: returns next pending task, indicates when all tasks are done, shows a progress table, and has strict sequencing rules (must not proceed without user approval). However, it doesn't mention error handling, rate limits, or authentication needs, leaving some gaps.

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 sequencing rules and repetitions (e.g., 'Do not skip the user's approval step' and 'In other words:'). Some sentences could be condensed without losing clarity, making it slightly less efficient.

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 no annotations and no output schema, the description does well by explaining return behavior (pending task, all_tasks_done, progress table) and sequencing constraints. However, it doesn't describe the output format (e.g., structure of returned task) or error cases, which could be important for a tool with complex workflow dependencies.

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%, so the description must compensate. It explains that requestId is used to identify which request's tasks to query, adding meaning beyond the bare schema. However, it doesn't specify the format or source of requestId (e.g., from list_requests), 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: 'return the next pending task (not done yet)' given a requestId. It distinguishes from siblings by specifying it returns pending tasks only, not all tasks or completed ones, and mentions specific sibling tools (approve_task_completion, approve_request_completion) for context.

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?

Explicit guidance is provided on when to use this tool vs alternatives: use after requestId is available, not after mark_task_done until approve_task_completion is called, and not after all_tasks_done until approve_request_completion. It names specific sibling tools (approve_task_completion, approve_request_completion, request_planning) as alternatives in different scenarios.

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

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