libtmux_mcp.tools.pane_tools.run_command
- libtmux_mcp.tools.pane_tools.run_command ( command: str, pane_id: str | None = None, session_name: str | None = None, session_id: str | None = None, window_id: str | None = None, timeout: float = 30.0, max_lines: int | None = None, suppress_history: bool = False, socket_name: str | None = None, ) Run
Command Result -
Run a shell command in a pane, wait for completion, and capture output.
Description#
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-forsignal 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. Reservewait_for_textfor output you did not author: another process, a human, or a background job.The command runs in a subshell, so
cd,exportand other shell state changes do not persist to later calls.- Parameters
-
-
session_name(str | None) # – Session name for pane resolution. -
session_id(str | None) # – Session ID (e.g. '$1') for pane resolution. -
timeout(float) # – Maximum seconds to wait for command completion. Capped by the same server wait ceiling aswait_for_text; an over-large value is not an error — the wait returns at the ceiling and the timeout actually enforced is reported onRunCommandResult.effective_timeout. -
max_lines(int | None) # – Maximum pane output lines to return. Defaults to all captured visible output; pass a small value for a tail-only summary. -
suppress_history(bool) # – 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. -
socket_name(str | None) # – tmux socket name.
- Returns
-
RunCommandResult Typed command result with exit status, timeout state, and tail-preserved pane output.
Discussed in Python MCP examples , Python MCP topics