Run command¶
run_command¶
Run a shell command in a pane, wait for completion, and capture output.
- Returns:
Use when you need to run a shell command in a pane and get a typed result with exit status, timeout state, and captured pane output.
Avoid when you need raw interactive key driving — use
send_keys for TUIs, key names, and partial commands.
Side effects: Sends a command to the pane’s interactive shell. The
command may read or write files, start processes, or access the network
depending on what the shell command does. Each command runs in a subshell,
so directory or environment changes do not persist across calls.
Set suppress_history=true for secret-bearing commands on shells that
honor leading-space history suppression.
Example:
{
"tool": "run_command",
"arguments": {
"command": "pytest -q",
"pane_id": "%2",
"timeout": 60
}
}
Response:
{
"pane_id": "%2",
"exit_status": 0,
"timed_out": false,
"elapsed_seconds": 4.2,
"output": ["..."],
"output_truncated": false,
"output_truncated_lines": 0
}
Parameters
Parameter |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
yes |
— |
Shell command to run in the target pane. |
|
|
no |
— |
Pane ID (e.g. ‘%1’). |
|
|
no |
— |
Session name for pane resolution. |
|
|
no |
— |
Session ID (e.g. ‘$1’) for pane resolution. |
|
|
no |
— |
Window ID for pane resolution. |
|
|
no |
|
Maximum seconds to wait for command completion. |
|
|
no |
— |
Maximum pane output lines to return. Defaults to all captured visible output; pass a small value for a tail-only summary. |
|
|
no |
|
Suppress shell history by prepending a space; only effective where the shell ignores space-prefixed commands. Default False. |
|
|
no |
— |
tmux socket name. |