Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

libtmux_mcp.tools.pane_tools.run_command

Python
  • Python
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

API reference · Markdown

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 ) → RunCommandResult
functionasync [source]
functionasync [source]
libtmux_mcp.tools.pane_tools.run_command

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 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.

Parameters
  • command ( str ) – Shell command to run in the target pane.

  • pane_id ( str | None ) – Pane ID (e.g. '%1').

  • session_name ( str | None ) – Session name for pane resolution.

  • session_id ( str | None ) – Session ID (e.g. '$1') for pane resolution.

  • window_id ( str | None ) – Window ID for pane resolution.

  • timeout ( float ) – 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.

  • 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

Esc

Type to search.