batch
Execute multiple iTerm2 terminal operations sequentially in a single connection to automate workflows, manage sessions, windows, and tabs with pause controls.
Instructions
Execute a batch of iTerm2 operations sequentially within a single connection.
Each operation is a dict with an "op" field naming the operation, plus any parameters for that operation. A special "sleep" operation pauses between steps.
Args: operations: List of operation dicts. Each must have an "op" field. Available ops: session_send, session_run, session_read, session_split, session_close, session_focus, session_clear, session_set_name, session_list, session_get_variable, session_set_variable, session_restart, window_new, window_close, window_focus, tab_new, tab_close, tab_select, tab_next, tab_prev, app_activate, broadcast_on, broadcast_off, send_keystrokes, profile_apply, sleep.
Sleep op: {"op": "sleep", "seconds": 0.5} or {"op": "sleep", "ms": 500}
Example batch:
[
{"op": "session_run", "command": "echo hello"},
{"op": "sleep", "seconds": 1.0},
{"op": "session_read"},
{"op": "session_send", "text": "world"}
]
stop_on_error: If true, abort the batch on the first error.Returns: JSON array of results, one per operation, with index, op name, and result or error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operations | Yes | ||
| stop_on_error | No |