Skip to main content
Glama

Wait for generation

wait_for_generation
Read-onlyIdempotent

Poll get_generation on a backoff until it reaches done / failed.

Args:
    uuid: The UUID returned by ``generate``.
    timeout_s: Return after this many seconds even if still running.
        Default 45 stays under the 60 s per-call limit most MCP clients
        enforce; a ``timeout`` result just means "call again". Only raise
        it (e.g. for video) on clients you know allow long tool calls.

Returns:
    The terminal generation record — which includes generations that
    failed server-side: those are SUCCESSFUL tool calls returning
    ``processing_state: "failed"`` with empty ``image_urls``, so always
    check the state. On tool failure, an ``isError`` result whose
    ``error`` field is ``"timeout"`` (``message`` names the last
    observed state — the generation keeps running server-side and can be
    re-fetched with ``get_generation`` later), ``"auth"``, or
    ``"failed"``.

    **Follow-up actions:** A ``done`` generation's
    ``processing_result.available_actions`` maps slot indices to valid
    action types — e.g. ``{"0": ["upscale_2x", "vary_strong",
    "pan_left", "zoom_out_1_5x", "img2img_basic", "img2img_inpaint",
    "img2vid_basic", ...],
    "global": ["reroll"]}``. Use ``execute_action`` with the ``uuid``, a chosen
    ``action_type``, and the ``parent_image_index`` (the slot key as an
    int) to run an action on a specific output image.

Input Schema

NameRequiredDescriptionDefault
uuidYesGeneration UUID to poll.
timeout_sNoMax seconds to wait before returning a timeout result.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Well beyond the readOnly/idempotent/openWorld annotations, the description discloses the backoff polling strategy, the 45s default tied to the 60s MCP per-call limit, and a precise error taxonomy ('timeout', 'auth', 'failed') with the crucial distinction that server-side 'failed' generations are still successful tool calls with empty image_urls. This is exactly the behavioral context annotations cannot carry.

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?

Front-loaded with the core behavior, then structured Args/Returns/follow-up sections. It is verbose and the timeout semantics are restated in both the arg paragraph and the Returns block, but nearly every sentence carries operational information.

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?

For a polling tool with an output schema, a single required param, and no nesting, this covers everything an agent needs: termination states, timeout semantics, error branches, and how to chain into execute_action using available_actions slot indices. Nothing material 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 semantics: timeout_s defaults to 45 to stay under the 60s client limit, a timeout is non-fatal since the generation keeps running, and which uuids are valid (those returned by generate). uuid adds no meaning beyond the schema, but timeout_s is meaningfully enriched.

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 first sentence names a specific verb (poll) and resource (get_generation), plus the termination condition (done/failed). It clearly distinguishes itself from the one-shot sibling get_generation and from generate, so an agent can pick it without opening either schema.

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?

It gives a concrete when-to-use context (waiting on a generate uuid), explains what a timeout result means ('call again'), and warns when to raise timeout_s (video, permissive clients). It routes follow-up work to execute_action, but never explicitly states the alternative (e.g. 'use get_generation for a single non-blocking check'), which keeps it just short of a 5.

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.