complete_task
Mark a task as completed by specifying the task ID, instance ID, and result to update task status and maintain orchestration progress within the MCP Orchestrator Server.
Instructions
Mark a task as completed
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_id | Yes | ID of the instance completing the task | |
| result | Yes | Result or output from the task | |
| task_id | Yes | ID of the task to complete |
Implementation Reference
- src/index.ts:255-295 (handler)Handler for the 'complete_task' tool: validates task and instance, updates task status to completed with result, saves tasks, identifies unlocked dependent tasks, and returns the completed task and 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 (schema)Schema definition for the 'complete_task' tool, including input schema with required parameters task_id, instance_id, and result, provided in the listTools response.{ 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"] } },