Skip to main content
Glama

Wait for several runs

wait_for_runs
Read-onlyIdempotent

Wait for several runs at once, named by ids (up to 100) or by the batch_id from create_runs, until every one has finished (succeeded, failed, cancelled, interrupted or timed_out) and its billing has settled, as wait_for_run does, or until the wait ends (at most 60 seconds). With mode "any" it returns as soon as one of them has finished and settled. Returns every run in order (status, model, output, error, cost, cost_final) and a summary: total, finished, by_status (counts), total_cost_micros, cost_final, pending_run_ids (the runs that have not finished or settled, in order), not_found_run_ids (ids that are not runs of this organization) and, when the runs use more than one model, by_model (each model's runs, finished, by_status, total_cost_micros, cost_final and run_ids, to compare them). If timed_out is true, call it again with ids set to summary.pending_run_ids. With timeout_seconds 1 it is a quick read of the set. COST: total_cost_micros is PROVISIONAL and usually higher than the final total until the summary's cost_final is true; quote it only then. A zero-data-retention run's output is returned by the first read after it finished, and then deleted.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "wait_for_runs"
  }
}

Input Schema

NameRequiredDescriptionDefault
idsNoThe runs' ids, as returned by create_run or create_runs. Give ids or batch_id.
modeNoall (default): wait until every run has finished and settled; any: until one has.
batch_idNoThe batch_id from create_runs: wait for all of its runs.
timeout_secondsNoHow long to wait, 1 to 60 (default 30).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare this a safe, idempotent read, and the description adds substantial behavior beyond them: the 60-second wait ceiling, terminal-state definitions, the settlement requirement, the provisional-vs-final cost warning ('quote it only then'), and the zero-data-retention rule that output is returned once and then deleted. That last point is exactly the kind of non-obvious behavior an agent cannot infer from annotations.

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

Conciseness4/5

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

Dense but earns its length: waiting semantics first, return shape second, retry and cost caveats last. The parenthetical enumeration of every return field plus the by_model breakdown is heavy, though it compensates for the absence of an output schema rather than being filler.

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

Completeness5/5

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

With no output schema and 4 optional parameters, the description carries the full burden and does: return fields, summary structure, by_model comparison, not_found_run_ids for foreign ids, and the retry loop on pending_run_ids. Nothing an agent needs to call it correctly or interpret the result is missing.

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 coverage is 100%, so the baseline is 3, but the description adds real meaning: batch_id is tied to create_runs, mode 'any' is explained in prose as returning on the first finished-and-settled run, and timeout_seconds 1 is given a concrete use ('a quick read of the set').

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 opens with a specific verb+resource ('Wait for several runs') and immediately scopes it: named by ids (up to 100) or by batch_id from create_runs. It distinguishes itself from the sibling wait_for_run ('as wait_for_run does') and from create_runs (source of batch_id), so an agent can tell them apart without opening schemas.

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?

Strong conditional guidance: call again with summary.pending_run_ids when timed_out is true, and use timeout_seconds 1 as a quick read of the set. It references wait_for_run as the single-run comparator but never explicitly states 'for one run use wait_for_run instead', so the routing is implied rather than spelled out.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources