MCPconceptAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

mcp.src.TmuxTools.run_command

#[tool_router(router = observe_router, vis = "pub(super)")] impl TmuxTools #[tool( name = "run_shell_command", description = "Run a shell command in a pane, wait for it to finish, and report its \ exit status with retained output. This is the tool for \"run this \ and tell me if it worked\". Output is the pane's raw output stream, not \ the rendered screen. Output is a bounded tail; check truncated before \ treating it as complete. The shell prompt is not \ included, and a line redrawn in place repeats; capture_pane shows the \ screen. The command \ runs in a subshell, so cd and export do not persist and invalid syntax \ completes with a nonzero status. Valid inherited Bash and zsh ERR and \ DEBUG traps remain visible to the command while parent-shell traps and \ options remain unchanged. It requires one configured input \ recipient and observes its mode, liveness, input-off state, attended-client \ state, cohort, inherited-caller relation, known POSIX shell, and resolved \ route before watcher setup and again before dispatch. A process-wide \ endpoint-and-pane reservation blocks other MCP pane input until the \ completion marker or pane closure is proved. The resolved tmux executable \ and socket path must contain no ASCII terminal-control bytes. The \ reservation serializes this MCP's input, but tmux observations can still \ race with dispatch. The pane shell, tmux server, and configuration must be \ trusted. Reaching the deadline, cancelling, or an uncertain dispatch stops \ this request while its watcher keeps the reservation until completion is \ proved. To stop the command, send_keys with keys [\"C-c\"] alone passes \ the reservation, and the command reports completion when it ends; \ respawn_pane with kill_first replaces a program that ignores C-c and C-\\.", title = "Run Command In Pane", meta = crate::capability_meta!(Execute, PaneCommand, [Change], [TmuxMetadata, TerminalContent], true, true, { "pane" => [TmuxLookup], "command" => [PaneInput, ShellCommand], "seconds" => [None], "suppress_history" => [None] }) )] pub async fn run_command( &self, Parameters(RunCommandArgs { pane, command, seconds, suppress_history, }): Parameters<RunCommandArgs>, cancelled: tokio_util::sync::CancellationToken, reporter: Reporter, ) -> Result<Json<RunView>, ToolError>

Run a command in a pane and report how it went.

Esc

Type to search.

Reference previewOpen reference