get_next_task
Retrieve the next available task from the MCP Orchestrator Server to coordinate work across multiple instances and manage task dependencies.
Instructions
Get the next available task
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instance_id | Yes | ID of the instance requesting work |
Implementation Reference
- src/index.ts:220-253 (handler)Implements the 'get_next_task' tool handler: finds next available pending task (dependencies completed), assigns to instance, sets to in_progress, saves, returns task.case "get_next_task": { const { instance_id } = request.params.arguments as { instance_id: string }; debug(`Instance ${instance_id} requesting next task`); // Find a pending task with no incomplete dependencies const availableTask = Object.values(tasks).find(task => { if (task.status !== 'pending') return false; if (!task.dependencies) return true; return task.dependencies.every(depId => tasks[depId]?.status === 'completed'); }); if (!availableTask) { debug('No tasks available'); return { content: [{ type: "text", text: JSON.stringify({ status: 'no_tasks' }, null, 2) }] }; } availableTask.status = 'in_progress'; availableTask.assignedTo = instance_id; saveTasks(); debug(`Assigned task ${availableTask.id} to instance ${instance_id}`); return { content: [{ type: "text", text: JSON.stringify(availableTask, null, 2) }] }; }
- src/index.ts:403-415 (schema)Input schema definition for 'get_next_task' tool in the tools list response.name: "get_next_task", description: "Get the next available task", inputSchema: { type: "object", properties: { instance_id: { type: "string", description: "ID of the instance requesting work" } }, required: ["instance_id"] } },