# run_shell_command

Source: https://libtmux.org/en/ts/latest/mcp/tools/run_shell_command/

> Run a shell command in a pane with your user's permissions. Run a shell command in a pane, wait for it to finish, and report its exit status and output. Prefer this over send_keys plus capture_pane: it frames the command so a pane's echo of what you typed can never be mistaken for what the command printed, and it knows when the command actually ended rather than guessing from the screen. The command runs in a subshell, so cd and export do not persist to a later call. A pane is effectively single-writer: this server reserves it until the command settles, but another process with the same tmux socket can still write into it.

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 with your user’s permissions. Run a shell command in a pane, wait for it to finish, and report its exit status and output. Prefer this over [send\_keys](https://libtmux.org/en/ts/latest/mcp/tools/send_keys/) plus [capture\_pane](https://libtmux.org/en/ts/latest/mcp/tools/capture_pane/): it frames the command so a pane’s echo of what you typed can never be mistaken for what the command printed, and it knows when the command actually ended rather than guessing from the screen. The command runs in a subshell, so cd and export do not persist to a later call. A pane is effectively single-writer: this server reserves it until the command settles, but another process with the same tmux socket can still write into it.

[All TypeScript tools](../) · [JSON](../run_shell_command.json) · [Source](https://github.com/libtmux/libtmux-ts/blob/3fe1ca654b81b8cbf4a13b777a001a3298c87a6f/packages/mcp/src/tools/input.ts#L304)

## Arguments

* `command` required · string

  The shell command to run.

* `force` optional · boolean

  Allow writing to the pane this server itself was called from, which is otherwise refused. It does not override the refusal to write to a pane a person is watching — a pane an attached client has on screen is still refused with force.

* `maxLines` optional · integer

  Keep at most this many lines, from the end. Defaults to the server limit.

* `paneId` required · string

  Stable pane id, e.g. %1.

* `timeoutMs` optional · integer

  How long to wait. Clamped by the server ceiling; the result says what was used.

## Schemas

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