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) }], }; }

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