claude_poll_task
Check the status of an asynchronous Claude Code task by run ID, retrieving new messages, output sizes, and elapsed time. Use drain mode to block until the task finishes and returns its full result.
Instructions
Poll an asynchronous task.
Two polling modes: - drain=false (default): returns immediately with current state (new messages, stdout/stderr byte counts, elapsed time). Use for tight control loops with explicit backoff. - drain=true: blocks until status is no longer 'running' (fire-and-wait). Note: this is bounded by your MCP client's request timeout, not the async task's timeout_s. For long blocks, prefer async drain with orchestrator-level polling.
Returns: ClaudePollTaskResponse with status (running|done|error|timeout|cancelled), new_messages, stdout_len/stderr_len, elapsed_seconds, and (once terminal) the full result with total_cost_usd, model_usage, and changes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| req | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | No | ||
| result | No | ||
| run_id | Yes | ||
| status | Yes | ||
| stderr_len | No | ||
| stdout_len | No | ||
| new_messages | No | ||
| elapsed_seconds | No |