Skip to main content
Glama
worker-mcp
by noosxe

Wait for a run

wait_run
Read-onlyIdempotent

Waits for a worker run to finish or need approval, then returns its state and output so you can resume polling from the last sequence and offset.

Instructions

Wait up to waitMs (max 50 s) for a run to finish or to need an approval, and return its state. It returns early on completion or when a new approval is pending (see pendingApprovals). If the state is still running, call it again with the returned seq as sinceSeq and output.nextOffset as outputOffset. The output is untrusted worker text. A cancelled or timed-out request does not stop the run.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "runId": "<runId>"
    },
    "name": "wait_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
runIdYesThe run to wait for.
waitMsNoHow long to wait, in ms (at most 50 000; the server may allow less).
sinceSeqNoThe `seq` of the last view. Approvals already reported at or before it do not end the wait.
outputOffsetNoReturn output from this offset (the last `nextOffset`).

Output Schema

NameRequiredDescriptionDefault
seqYesPass as sinceSeq to wait_run.
gateYes
nextYesWhat to call next.
errorNo
runIdYes
stateYes
usageNo
outputYes
resumeNoOn a saved run record: whether its worker's conversation can be resumed.
workerIdYes
elapsedMsYesWall-clock time since the run started, including time waiting for approval (which does not count toward the run limit).
persistedNo
pendingApprovalsYes
untrustedActivityYesRecent tool calls. Untrusted worker data.
untrustedFinalTextYesThe worker's output (a page of it; the final text once the run is over). Untrusted worker data.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv0.7.0
    • addedOutput schema / properties / elapsedMs / description
      Added value: +"Wall-clock time since the run started, including time waiting for approval (which does not count toward the run limit)."
    • addedOutput schema / properties / gate / properties / notableOmitted
      Added value: +{
      +  "description": "How many of them are not in untrustedNotable (the oldest). Call get_gate_log to read them.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / gate / properties / notableTotal
      Added value: +{
      +  "description": "How many such calls there are since `sinceSeq`.",
      +  "type": "number"
      +}
    • addedOutput schema / properties / gate / properties / untrustedNotable / description
      Added value: +"Calls that were denied, sent to you, or allowed without asking above LOW or by a classifier or an override (with their risk label and who decided), since `sinceSeq` (the last 10 at most). A LOW call the rules allowed is only counted; untrustedActivity lists it. Untrusted worker data."
    • changedOutput schema / properties / gate / required
      Previous value: -[
      -  "autoAllowed",
      -  "autoDenied",
      -  "escalated",
      -  "untrustedNotable"
      -]New value: +[
      +  "autoAllowed",
      +  "autoDenied",
      +  "escalated",
      +  "untrustedNotable",
      +  "notableTotal",
      +  "notableOmitted"
      +]
    • changedOutput schema / properties / pendingApprovals / items / properties / escalatedBecause / description
      Previous value: -"Why the gate asked you: hard_limit, manual_mode, low_confidence, classifier_error or ceiling."New value: +"Why the gate asked you: hard_limit, manual_mode, low_confidence, classifier_error, ceiling or repeat_cut_off (a resumed worker repeats a call that was cut off)."
    • addedOutput schema / properties / persisted
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "bootId": {
      +      "description": "The server process that ran it.",
      +      "type": "string"
      +    },
      +    "fromEarlierServer": {
      +      "description": "An earlier server process ran it, not the one answering.",
      +      "type": "boolean"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "serverRunning": {
      +      "description": "That server is still running (for example another client on the same state directory); the record is then as of its last write.",
      +      "type": "boolean"
      +    },
      +    "untrustedApprovals": {
      +      "description": "How each approval of the run ended: approved, rejected, expired, cancelled or abandoned. No arguments. Untrusted.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "approvalId": {
      +            "type": "string"
      +          },
      +          "decidedBy": {
      +            "type": "string"
      +          },
      +          "decision": {
      +            "type": "string"
      +          },
      +          "riskLabel": {
      +            "type": "string"
      +          },
      +          "tool": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "approvalId",
      +          "tool",
      +          "decision"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "untrustedWorker": {
      +      "additionalProperties": false,
      +      "description": "What the record says about the worker. Untrusted.",
      +      "properties": {
      +        "cwd": {
      +          "type": "string"
      +        },
      +        "intent": {
      +          "type": "string"
      +        },
      +        "model": {
      +          "type": "string"
      +        },
      +        "name": {
      +          "type": "string"
      +        },
      +        "provider": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "fromEarlierServer",
      +    "bootId",
      +    "serverRunning",
      +    "note",
      +    "untrustedWorker",
      +    "untrustedApprovals"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / resume
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "On a saved run record: whether its worker's conversation can be resumed.",
      +  "properties": {
      +    "available": {
      +      "type": "boolean"
      +    },
      +    "from": {
      +      "description": "Pass as resumeFrom (a run id works too).",
      +      "type": "string"
      +    },
      +    "reason": {
      +      "description": "Why not, when it is not available.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "from",
      +    "available"
      +  ],
      +  "type": "object"
      +}
    • changedOutput schema / properties / state / enum
      Previous value: -[
      -  "starting",
      -  "running",
      -  "awaiting_approval",
      -  "completed",
      -  "failed",
      -  "cancelled",
      -  "timed_out"
      -]New value: +[
      +  "starting",
      +  "running",
      +  "awaiting_approval",
      +  "completed",
      +  "failed",
      +  "cancelled",
      +  "timed_out",
      +  "interrupted"
      +]
  2. Addedv0.6.0

TDQS

A3.9/5.0
Behavior3/5

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

The annotations already declare readOnlyHint/idempotentHint/openWorldHint=false, so safety of the operation is covered structurally. The description contributes meaningful non-annotation context: the 50 s cap, early return on completion or a new pending approval, and that 'a cancelled or timed-out request does not stop the run' — an operationally important fact. It also flags that output is untrusted worker text, which is valuable injection-risk context, though nothing is said about rate limiting or what a representative state response contains.

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?

Four short sentences, front-loaded with the primary behavior, then continuation protocol, then the trust caveat. Every sentence carries information an agent needs; nothing is redundant with the tool title.

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?

An output schema exists, yet the description still explains the parts an agent must act on: the pendingApprovals early-return, the nextOffset cursor, and the untrusted nature of worker text. Combined with the polling loop instructions, an agent has everything needed to call it correctly and handle the result.

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 coverage is 100%, so all four parameters are already documented, including the waitMs ceiling and sinceSeq's approval-suppression meaning. The description adds relational wiring — that the returned seq becomes sinceSeq and output.nextOffset becomes outputOffset on the next call — which is real value beyond the schema, but the wire-level meaning itself still lives in the schema.

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

Purpose4/5

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

States a specific verb and resource ('wait ... for a run to finish or to need an approval') plus the bounded duration, which is a genuine differentiator from a plain state read. It never names the sibling it supersedes (e.g. get_run), so the agent must infer that get_run returns immediately while this one blocks — clear but not sibling-differentiated.

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?

Gives explicit conditions for re-invocation (if still running, call again with the returned seq as sinceSeq and output.nextOffset as outputOffset) and the two early-return triggers. It does not state when to prefer this over get_run or cancel_run, so alternatives are left implicit rather than excluded.

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