execute_task
Delegate implementation tasks to Grok for file edits, test runs, and shell commands. Use after user approval to execute code changes and return a session ID for continued work.
Instructions
MUTATING: Delegate implementation to Grok (file edits, tests, shell). Uses --always-approve. Only call after the user approved a plan or explicitly asked to implement. Verify with git diff/tests afterwards. Returns session_id for continue_task.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | Yes | Absolute path to the target project working directory | |
| model | No | Optional Grok model id (defaults to CLI / MCP_GROK_MODEL) | |
| prompt | Yes | Task instructions for Grok (be specific about files, tests, constraints) | |
| max_turns | No | Max agentic turns for Grok | |
| background | No | If true, start Grok in background and return job_id immediately | |
| session_id | No | Optional UUID to create/resume a named Grok session for multi-step work | |
| timeout_sec | No | Timeout in seconds (default 600) |