execute_command
Runs a user-approved staged command in an iTerm2 session, waits for output to settle or a prompt, and returns only the new terminal output.
Instructions
Press Enter on the staged command (only after the user approved it). By default waits until the output settles or a prompt returns, then returns just the new output — no separate read needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| grep | No | Only return lines matching this regex (case-insensitive). | |
| wait | No | Wait for and return output (default true). | |
| max_chars | No | Cap on returned text, keeping the most recent (default 6000). | |
| settle_ms | No | Treat output as done after this long unchanged (default 1200). | |
| timeout_s | No | Max seconds to wait (default 20). | |
| session_id | No | Session ID from list_iterm_sessions. Optional: defaults to the last session used. | |
| prompt_regex | No | Regex matching the prompt line, if the default guess doesn't fit. |