Skip to main content
Glama

wait_for_all

Blocks execution until all specified agents reach a target state or any agent encounters an error, enabling coordinated parallel agent orchestration with fail-fast behavior.

Instructions

Block until ALL agents reach target state OR any agent errors (fail-fast with partial results).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idsYesArray of agent IDs
target_stateYesState to wait for
timeout_msNoTimeout in milliseconds (default: 5 minutes)

Implementation Reference

  • The core handler logic for the 'wait_for_all' tool in the AgentEngine class.
    async waitForAll(
      agentIds: string[],
      targetState: AgentState,
      timeoutMs: number,
    ): Promise<WaitResult[]> {
      const results = await Promise.all(
        agentIds.map((id) => this.waitFor(id, targetState, timeoutMs)),
      );
      return results;
    }
  • src/server.ts:747-775 (registration)
    MCP tool registration for 'wait_for_all' and the adapter function that calls the underlying engine.
    // 13. wait_for_all
    server.tool(
      "wait_for_all",
      "Block until ALL agents reach target state OR any agent errors (fail-fast with partial results).",
      {
        agent_ids: z.array(z.string()).describe("Array of agent IDs"),
        target_state: z
          .enum(["ready", "working", "idle", "done", "error"])
          .describe("State to wait for"),
        timeout_ms: z
          .number()
          .int()
          .positive()
          .optional()
          .default(300000)
          .describe("Timeout in milliseconds (default: 5 minutes)"),
      },
      async (args) => {
        try {
          const results = await engine.waitForAll(
            args.agent_ids,
            args.target_state,
            args.timeout_ms,
          );
          return ok({ results });
        } catch (e) {
          return err(e);
        }
      },
Behavior4/5

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

With no annotations provided, the description carries full burden and effectively discloses key behavioral traits: it blocks execution, waits for all agents to reach a target state, implements fail-fast on any error, and returns partial results on failure. However, it does not mention permissions, rate limits, or detailed error handling.

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, dense sentence with zero waste—every word contributes essential information about blocking behavior, conditions (all agents reach state or any errors), and fail-fast with partial results. It is front-loaded and efficiently structured.

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

Completeness4/5

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

Given the tool's complexity (coordinating multiple agents) and no annotations or output schema, the description is mostly complete but could enhance clarity on error types or result format. It covers core behavior adequately but leaves some operational details implicit.

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

Parameters3/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 parameters. The description adds no additional meaning beyond what the schema provides (e.g., no clarification on 'agent_ids' format or 'target_state' implications). Baseline 3 is appropriate as the schema handles parameter documentation.

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

Purpose5/5

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

The description clearly states the specific action ('Block until') and target ('ALL agents reach target state OR any agent errors'), distinguishing it from sibling 'wait_for' which likely handles different conditions. It precisely defines the verb (block/wait), resource (agents), and scope (all vs. any error).

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

Usage Guidelines4/5

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

The description implies usage for monitoring multiple agents' states with fail-fast behavior, but does not explicitly state when to use this tool versus alternatives like 'get_agent_state' or 'wait_for'. It provides clear context (waiting for state changes) but lacks explicit exclusions or named alternatives.

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/EtanHey/cmuxlayer'

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