claude_run_task
Executes a single Claude task synchronously with a 600-second limit, returning the result, exit code, cost, and optional git diff. Supports configurable model, permission mode, and timeout.
Instructions
Run a single Claude task synchronously (bounded by FastMCP's 600s wrapper cap).
Required: workspace_path, prompt. Common options: model (alias from Settings.claude_model_aliases), fallback_model, permission_mode, options.timeout_s (default 300, max 600), capture_changes.
Estimated cost depends on model and prompt size — check total_cost_usd
in the response. Typical ranges: haiku ~$0.02, sonnet ~$0.50, opus ~$1.50.
For tasks that may exceed 600s (architecture, migration, large refactors),
use claude_start_task (async) instead. For timeout routing, call the
claude_timeout_help prompt first.
Returns: ClaudeRunTaskResponse with result, stdout/stderr, exit_code, timed_out, total_cost_usd, model_usage, and (if capture_changes=true) a unified git diff of workspace changes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| req | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | No | ||
| result | Yes | ||
| run_id | Yes | ||
| status | Yes | ||
| changes | No | ||
| exit_code | Yes | ||
| num_turns | No | ||
| final_text | Yes | ||
| session_id | No | ||
| duration_ms | No | ||
| model_usage | No | ||
| total_cost_usd | No |