complete_task
Mark a task as completed in the MCP Orchestrator Server by providing the task ID, instance ID, and result to update task status and track progress.
Instructions
Mark a task as completed
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ID of the task to complete | |
| instance_id | Yes | ID of the instance completing the task | |
| result | Yes | Result or output from the task |
Implementation Reference
- src/index.ts:255-295 (handler)Handler function for the 'complete_task' tool. Validates the task assignment, updates task status to 'completed', saves the task data, identifies unlocked dependent tasks, and returns the completed task details along with any newly unlocked tasks.case "complete_task": { const { task_id, instance_id, result } = request.params.arguments as { task_id: string; instance_id: string; result: string; }; debug(`Instance ${instance_id} completing task ${task_id}`); const task = tasks[task_id]; if (!task) { throw new McpError(ErrorCode.InvalidRequest, `Task ${task_id} not found`); } if (task.assignedTo !== instance_id) { throw new McpError(ErrorCode.InvalidRequest, `Task ${task_id} is not assigned to instance ${instance_id}`); } task.status = 'completed'; task.result = result; saveTasks(); debug(`Task ${task_id} completed by instance ${instance_id}`); // Find tasks that can now be started const unlockedTasks = Object.values(tasks).filter(t => t.status === 'pending' && t.dependencies?.includes(task_id) && t.dependencies.every(depId => tasks[depId]?.status === 'completed') ); return { content: [{ type: "text", text: JSON.stringify({ completed_task: task, unlocked_tasks: unlockedTasks }, null, 2) }] }; }
- src/index.ts:416-437 (registration)Registration of the 'complete_task' tool in the list of available tools, including its name, description, and input schema definition for validation.{ name: "complete_task", description: "Mark a task as completed", inputSchema: { type: "object", properties: { task_id: { type: "string", description: "ID of the task to complete" }, instance_id: { type: "string", description: "ID of the instance completing the task" }, result: { type: "string", description: "Result or output from the task" } }, required: ["task_id", "instance_id", "result"] } },
- src/index.ts:419-436 (schema)Input schema for the 'complete_task' tool, defining the required parameters: task_id, instance_id, and result.inputSchema: { type: "object", properties: { task_id: { type: "string", description: "ID of the task to complete" }, instance_id: { type: "string", description: "ID of the instance completing the task" }, result: { type: "string", description: "Result or output from the task" } }, required: ["task_id", "instance_id", "result"] }