# run_command

Source: https://libtmux.org/en/py/latest/mcp/tools/run_command/

> Run a shell command in a pane, wait for completion, and capture output.

MCP is in development

Server behavior and tool contracts may change. Tool availability depends on the server configuration.

Run a shell command in a pane, wait for completion, and capture output.

Use for the common terminal workflow: run this command, wait until it completes, then report whether it succeeded. The command is sent to the pane’s interactive shell, followed by a private `tmux wait-for` signal and a private pane option carrying the shell exit status. This is the AUTHORED-output path — the command you pass is what the wait synchronizes on. Reserve [`wait_for_text`](https://libtmux.org/en/py/latest/mcp/tools/wait_for_text/) for output you did not author: another process, a human, or a background job.

The command runs in a subshell, so `cd`, `export` and other shell state changes do not persist to later calls.

[All Python tools](../) · [JSON](../run_command.json) · [Source](https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/pane_tools/__init__.py#L96)

## Arguments

* `command` required · string

  Shell command to run in the target pane.

* `max_lines` optional

  Maximum pane output lines to return. Defaults to all captured visible output; pass a small value for a tail-only summary.

  Default: `null`.

* `pane_id` optional

  Pane ID (e.g. '%1').

  Default: `null`.

* `session_id` optional

  Session ID (e.g. '$1') for pane resolution.

  Default: `null`.

* `session_name` optional

  Session name for pane resolution.

  Default: `null`.

* `socket_name` optional

  tmux socket name.

  Default: `null`.

* `suppress_history` optional · boolean

  For MCP calls, omission uses the server's LIBTMUX\_SUPPRESS\_HISTORY default; an explicit value overrides it. Direct Python calls default to False. Best effort: the shell must honor space-prefixed history suppression. Suppression requires a single-line command; multiline commands remain available when suppression is false.

  Default: `true`.

* `timeout` optional · number

  Maximum seconds to wait for command completion. Capped by the same server wait ceiling as \`\`wait\_for\_text\`\`; an over-large value is not an error — the wait returns at the ceiling and the timeout actually enforced is reported on \`\`RunCommandResult.effective\_timeout\`\`.

  Default: `30`.

* `window_id` optional

  Window ID for pane resolution.

  Default: `null`.

## Schemas

The schema defines required fields, nested values, defaults, and validation constraints.
