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"]
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It implies a read operation but doesn't disclose behavioral traits like whether this marks tasks as in-progress, affects task state, has rate limits, or requires specific permissions. The phrase 'next available' hints at queue behavior but lacks detail on concurrency or locking mechanisms.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of task management and lack of annotations or output schema, the description is incomplete. It doesn't explain what 'next available' entails, how tasks are prioritized, what data is returned, or error conditions, leaving significant gaps for an AI agent to understand the tool's behavior in context with its siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the single parameter 'instance_id'. The description doesn't add meaning beyond the schema, but with 0 parameters needing extra explanation, a baseline of 4 is appropriate as no compensation is required for gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get the next available task' clearly states the action (get) and resource (task), but it's vague about what 'next available' means in context. It doesn't distinguish this tool from siblings like 'get_task_details' or 'get_task_status', leaving ambiguity about whether this fetches a specific task or the next one in a queue.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'get_task_details' and 'get_task_status', the description doesn't clarify if this is for polling workflows, task assignment, or other contexts, nor does it mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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