approve_request_completion
Finalizes and approves completed requests in the MCP task manager. Displays a progress table for task status before confirmation. If not approved, use the 'request_planning' tool to add tasks and continue the process.
Instructions
After all tasks are done and approved, this tool finalizes the entire request. The user must call this to confirm that the request is fully completed.
A progress table showing the final status of all tasks will be displayed before requesting final approval.
If not approved, the user can add new tasks using 'request_planning' and continue the process.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| requestId | Yes |
Implementation Reference
- index.ts:511-533 (handler)Core handler function that approves and marks the entire request as completed after verifying all tasks are done and approved.public async approveRequestCompletion(requestId: string) { await this.loadTasks(); const req = this.data.requests.find((r) => r.requestId === requestId); if (!req) return { status: "error", message: "Request not found" }; // Check if all tasks are done and approved const allDone = req.tasks.every((t) => t.done); if (!allDone) { return { status: "error", message: "Not all tasks are done." }; } const allApproved = req.tasks.every((t) => t.done && t.approved); if (!allApproved) { return { status: "error", message: "Not all done tasks are approved." }; } req.completed = true; await this.saveTasks(); return { status: "request_approved_complete", requestId: req.requestId, message: "Request is fully completed and approved.", }; }
- index.ts:67-69 (schema)Zod schema defining the input structure for the approve_request_completion tool (requires requestId).const ApproveRequestCompletionSchema = z.object({ requestId: z.string(), });
- index.ts:187-200 (registration)Tool registration object defining name, description, and input schema for listTools response.const APPROVE_REQUEST_COMPLETION_TOOL: Tool = { name: "approve_request_completion", description: "After all tasks are done and approved, this tool finalizes the entire request. The user must call this to confirm that the request is fully completed.\n\n" + "A progress table showing the final status of all tasks will be displayed before requesting final approval.\n\n" + "If not approved, the user can add new tasks using 'request_planning' and continue the process.", inputSchema: { type: "object", properties: { requestId: { type: "string" }, }, required: ["requestId"], }, };
- index.ts:763-774 (handler)Dispatcher case in CallToolRequestSchema handler that validates input and calls the core approveRequestCompletion method.case "approve_request_completion": { const parsed = ApproveRequestCompletionSchema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments: ${parsed.error}`); } const { requestId } = parsed.data; const result = await taskManagerServer.approveRequestCompletion(requestId); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- index.ts:683-696 (registration)Registers the approve_request_completion tool (via APPROVE_REQUEST_COMPLETION_TOOL) in the list of available tools.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, ], }));