# run_and_wait

Source: https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/

> Run a shell command in a tmux pane and wait for completion.

promptMCPlatest

MCP is in development

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

* **run_and_wait**( [command](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.parameter.command), [pane_id](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.parameter.pane_id), [timeout](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.parameter.timeout)?, )

  prompt[¶](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait)

  Run a shell command in a tmux pane and wait for completion.

  The returned template teaches the high-level authored-command primitive: [`run_command`](https://libtmux.org/en/py/latest/mcp/tools/run_command/) sends the command, waits through a private tmux signal, captures output, and reports exit status in one typed result. Use lower-level [`send_keys`](https://libtmux.org/en/py/latest/mcp/tools/send_keys/) + [`wait_for_channel`](https://libtmux.org/en/py/latest/mcp/tools/wait_for_channel/) only when the caller needs custom shell composition outside this common command-completion shape.

  * MCP request method

    `prompts/get` Send `run_and_wait` as the prompt name, with the arguments below.

  ## Arguments[#](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.parameters)

  * `command`[#](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.parameter.command)

    The shell command to run.

    Provide a value matching the following JSON schema: {“type”:“string”}. Encode non-string values as JSON.

    * Binding

      Prompt argument

    * Required

      Yes

  * `pane_id`[#](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.parameter.pane_id)

    Target pane (e.g. `%1`).

    Provide a value matching the following JSON schema: {“type”:“string”}. Encode non-string values as JSON.

    * Binding

      Prompt argument

    * Required

      Yes

  * `timeout`[#](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.parameter.timeout)

    Maximum seconds to wait for command completion. Default 60.

    Provide a value matching the following JSON schema: {“type”:“number”}. Encode non-string values as JSON.

    * Binding

      Prompt argument

    * Required

      No

  ## Result[#](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.result)

  Returns the prompt’s messages. The client supplies the advertised arguments as strings.

  ## Protocol data[#](https://libtmux.org/en/py/latest/mcp/prompts/run_and_wait/#mcp.prompt.run_and_wait.schemas)

  Use the complete advertised contract for validation and client integration.

  Registration

  ```json
  {
    "_meta": {
      "fastmcp": {
        "tags": []
      }
    },
    "arguments": [
      {
        "description": "The shell command to run.\n\nProvide a value matching the following JSON schema: {\"type\":\"string\"}. Encode non-string values as JSON.",
        "name": "command",
        "required": true
      },
      {
        "description": "Target pane (e.g. ``%1``).\n\nProvide a value matching the following JSON schema: {\"type\":\"string\"}. Encode non-string values as JSON.",
        "name": "pane_id",
        "required": true
      },
      {
        "description": "Maximum seconds to wait for command completion. Default 60.\n\nProvide a value matching the following JSON schema: {\"type\":\"number\"}. Encode non-string values as JSON.",
        "name": "timeout",
        "required": false
      }
    ],
    "description": "Run a shell command in a tmux pane and wait for completion.\n\nThe returned template teaches the high-level authored-command\nprimitive: ``run_command`` sends the command, waits through a\nprivate tmux signal, captures output, and reports exit status in\none typed result. Use lower-level ``send_keys`` +\n``wait_for_channel`` only when the caller needs custom shell\ncomposition outside this common command-completion shape.",
    "name": "run_and_wait"
  }
  ```

Source revision: [tmux-python/libtmux-mcp@4daddc0dfca96c43bf521d818bf91564e1434760](https://github.com/tmux-python/libtmux-mcp/tree/4daddc0dfca96c43bf521d818bf91564e1434760).
