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
| Name | Required | Description | Default |
|---|---|---|---|
| until | No | timeout | |
| detail | No | compact | |
| task_id | Yes | ||
| include_tail | No | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||