Skip to main content
Glama

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
NameRequiredDescriptionDefault
instance_idYesID of the instance requesting work

Implementation Reference

  • 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) }] }; }
  • 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"] } },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mokafari/orchestrator-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server