Skip to main content
Glama

wait_for_task

Await a dispatched task’s completion or timeout to monitor long-running work, returning status and recent activity without interrupting the running process.

Instructions

Wait for a task to finish, giving up after a timeout without disturbing the run.

Args: task_id: Identifier of the task to await. timeout_seconds: How long to hold, 0..3600 (default 50; 0 observes once without sleeping). Honoured as asked, never silently clamped; out of range is INVALID_PARAMS. Breaking change: values above 3600 are now rejected (0 is newly accepted). Your MCP client applies its own request deadline, and exceeding it fails the call even though the task keeps running — see docs/multi-task-waiting.md before asking for long holds. include_tail: If True, include the full last_output_tail (20 lines × 2000 chars each); if False (default), the tail is omitted for running/completed tasks and shortened to 5 lines × 500 chars for failed tasks. detail: "compact" (default) omits static execution metadata and detailed outcome probes; "full" returns complete MCP status. Both preserve the complete summary/report, approval attention, failure diagnostics and wait fields. include_tail=True retains the full tail in either mode. until: "timeout" (default) returns when the task settles or timeout_seconds elapses. "terminal" holds until the task settles, bounded only by a 6 hour server ceiling; timeout_seconds must then be omitted (passing both is INVALID_PARAMS). ctx: Injected by the server; not a caller argument.

The result is the task status plus requested_timeout_seconds, effective_timeout_seconds, until, timed_out, stop_reason (terminal, attention, timeout, ceiling or observation_unavailable), elapsed_seconds and polling_guidance. If the task is still going when the wait ends, the status is "running" with a next_step hint: call this again, or poll get_task_status. The dispatched process is never signalled, written or resumed by a wait, so waiting is always safe and repeating it costs nothing. For a task recovered from an earlier server process the result carries outcome_observed once it is finished or the wait stopped as observation_unavailable: false (normally with stop_reason observation_unavailable) means its process is gone but its exit was never observed, so the status is an inference — inspect it with get_task_status; true otherwise. It is never present on a task that is still running. Live tasks carry it (true) once finished. Undecided approvals and approval uncertainty stop the wait as attention. Answered approvals still awaiting delivery keep waiting. Older summaries without a decision count retain attention. Approval attention alone says nothing about process liveness. Progress is sent every 5 seconds, best effort. Returns recent_activity — a list of ≤ 5 one-line strings describing the most recent meaningful events — for a live summary without the bulk of the raw stream.

A task still waiting for its resources is running as far as a wait is concerned: the wait holds until it spawns and settles, or reports not_started if it never starts.

Prefer holds <=50 seconds after remote "device did not respond" or "connection closed" deadline errors; the task continues and a shorter wait is safe to repeat.

A coding task can easily run for many minutes. Expect several calls rather than one long one. Confirmed usage limits retain failure_diagnostic and partial output while the task owner settles the process. Waiting does not retry the task or authorize a paid fallback.

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": {
      "task_id": "<task_id>"
    },
    "name": "wait_for_task"
  }
}

Input Schema

NameRequiredDescriptionDefault
untilNotimeout
detailNocompact
task_idYes
include_tailNo
timeout_secondsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.14

TDQS

A4.9/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: the dispatched process is never signalled, written or resumed; waiting is safe and free to repeat; progress arrives every 5 seconds best-effort; a 6-hour server ceiling bounds terminal waits; out-of-range timeouts are rejected as INVALID_PARAMS rather than clamped. It also discloses subtle semantics — attention stop reasons say nothing about process liveness, and outcome_observed is absent while running and false only for recovered tasks whose exit was never seen.

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?

It is front-loaded with a one-sentence purpose followed by a clean Args block, and most paragraphs earn their place given zero schema coverage. Some prose is redundant — the outcome_observed paragraph restates 'never present on a task that is still running' after already saying it, and the approval paragraphs are dense — but nothing is fatally padded.

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 five-parameter blocking tool with no annotations and 0% schema coverage, the description covers purpose, safety, timing, failure modes, approval interactions, and recovery edge cases. It also describes return fields (stop_reason, timed_out, recent_activity, polling_guidance) even though an output schema exists, which is additive rather than misleading.

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

Parameters5/5

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

Schema coverage is 0%, so the description must compensate and it does, defining every argument: timeout_seconds range 0..3600 with defaults, the 0-means-observe-once behavior, include_tail's exact line/char budgets per status, detail's compact-vs-full content split, and the mutual exclusion between until='terminal' and timeout_seconds. It even flags ctx as server-injected rather than a caller argument.

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 opening sentence states a specific verb and resource plus the defining constraint: 'Wait for a task to finish, giving up after a timeout without disturbing the run.' It also differentiates itself from a named alternative ('poll get_task_status'), so an agent can distinguish a blocking wait from a status poll without opening the schema.

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

Usage Guidelines5/5

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

Guidance is explicit and conditional: prefer holds <=50s after 'device did not respond'/'connection closed' errors, expect several calls rather than one long one for coding tasks, use until='terminal' only when timeout_seconds is omitted, and call again or fall back to get_task_status when the wait ends while still running. It states both when to use and how to sequence repeats.

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