approve_task_completion
Mark a task as completed after verification using the task ID and request ID. View progress table before approving to ensure task completion. Proceed to next task only after approval.
Instructions
Once the assistant has marked a task as done using 'mark_task_done', the user must call this tool to approve that the task is genuinely completed. Only after this approval can you proceed to 'get_next_task' to move on.
A progress table will be displayed before requesting approval, showing the current status of all tasks.
If the user does not approve, do not call 'get_next_task'. Instead, the user may request changes, or even re-plan tasks by using 'request_planning' again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes | ||
| taskId | Yes |
Implementation Reference
- index.ts:486-509 (handler)Core handler method in TaskManagerServer class that approves a task completion by marking it as approved after validation, updates the data file, and returns the status.public async approveTaskCompletion(requestId: string, taskId: string) { await this.loadTasks(); const req = this.data.requests.find((r) => r.requestId === requestId); if (!req) return { status: "error", message: "Request not found" }; const task = req.tasks.find((t) => t.id === taskId); if (!task) return { status: "error", message: "Task not found" }; if (!task.done) return { status: "error", message: "Task not done yet." }; if (task.approved) return { status: "already_approved", message: "Task already approved." }; task.approved = true; await this.saveTasks(); return { status: "task_approved", requestId: req.requestId, task: { id: task.id, title: task.title, description: task.description, completedDetails: task.completedDetails, approved: task.approved, }, }; }
- index.ts:748-761 (handler)MCP server dispatch handler for the tool: parses input with schema and invokes the core approveTaskCompletion method.case "approve_task_completion": { const parsed = ApproveTaskCompletionSchema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments: ${parsed.error}`); } const { requestId, taskId } = parsed.data; const result = await taskManagerServer.approveTaskCompletion( requestId, taskId ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- index.ts:62-65 (schema)Zod schema defining input parameters: requestId and taskId.const ApproveTaskCompletionSchema = z.object({ requestId: z.string(), taskId: z.string(), });
- index.ts:171-185 (registration)Tool object registration defining name, detailed description, and input schema.const APPROVE_TASK_COMPLETION_TOOL: Tool = { name: "approve_task_completion", description: "Once the assistant has marked a task as done using 'mark_task_done', the user must call this tool to approve that the task is genuinely completed. Only after this approval can you proceed to 'get_next_task' to move on.\n\n" + "A progress table will be displayed before requesting approval, showing the current status of all tasks.\n\n" + "If the user does not approve, do not call 'get_next_task'. Instead, the user may request changes, or even re-plan tasks by using 'request_planning' again.", inputSchema: { type: "object", properties: { requestId: { type: "string" }, taskId: { type: "string" }, }, required: ["requestId", "taskId"], }, };
- index.ts:684-696 (registration)Registration in the listTools handler, including APPROVE_TASK_COMPLETION_TOOL in the exported tools list.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, ], }));