session_wait
Block until an interactive Claude Code session finishes its pending work and retrieve the final response. Supports timeouts with partial results, resumable without losing progress, and optional auto-compact.
Instructions
Block until the session finishes its pending work, then return the answer.
This is the completion trigger: it returns Claude's final response as the tool result.
Resumable. If timeout (seconds, max 3600) elapses while Claude is
still working, this returns timed_out: true with the partial transcript
and keeps the pending dispatch — just call it again. Nothing is lost.
Set auto_compact_at (e.g. 70) to run /compact automatically when context
usage crosses that percentage after the turn completes.
Returns {response, state, timed_out, baseline, elapsed_s, steers}.
baseline: "lost" means this server restarted since the prompt was sent,
so response is a plain tail of the pane rather than an exact diff.
A question field appears when the session stopped on a prompt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| timeout | No | ||
| auto_compact_at | No |