# capture_pane

Source: https://libtmux.org/en/py/stable/mcp/tools/capture_pane/

> Capture the visible contents of a tmux pane (terminal scrollback).

tool MCPstable

MCP is in development

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

* **capture_pane**( [end](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fend)?: [integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [max_lines](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fmax_lines)?: [integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [pane_id](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fpane_id)?: [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [session_id](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fsession_id)?: [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [session_name](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fsession_name)?: [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [socket_name](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fsocket_name)?: [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [start](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fstart)?: [integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), [window_id](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fwindow_id)?: [string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"), )

  tool \[[source](https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/pane_tools/__init__.py#L101)][¶](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane)

  Capture the visible contents of a tmux pane (terminal scrollback).

  Use for tmux pane output — ‘capture the build log’, ‘what did the server print’ — not editor file contents. The tool for reading what is displayed in a terminal; use [search_panes](https://libtmux.org/en/py/stable/mcp/tools/search_panes/) to search across multiple panes at once.

  Output is tail-preserved: when the capture exceeds `max_lines` the oldest lines are dropped and the returned string is prefixed with a single `[... truncated K lines ...]` header line so the agent can tell truncation occurred and re-request with a narrower `start`/`end` window or a larger `max_lines` if needed. Pass `max_lines=None` to disable truncation entirely.

  * MCP request method

    `tools/call` Send `capture_pane` as the tool name, with the arguments below.

  ## Arguments[#](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.parameters)

  * **[`end`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fend)**? = `null` ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    End line number.

  * **[`max_lines`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fmax_lines)**? = `500` ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Maximum number of lines to return. Defaults to `CAPTURE_DEFAULT_MAX_LINES`. Pass `None` to return the full capture with no truncation.

  * **[`pane_id`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fpane_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Pane ID (e.g. ‘%1’).

  * **[`session_id`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fsession_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Session ID (e.g. ‘$1’) for pane resolution.

  * **[`session_name`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fsession_name)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Session name for pane resolution.

  * **[`socket_name`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fsocket_name)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    tmux socket name.

  * **[`start`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fstart)**? = `null` ([integer](https://json-schema.org/understanding-json-schema/reference/numeric "numeric (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Start line number. 0 is the first visible line. Negative values reach into scrollback history (e.g. -100 for last 100 lines).

  * **[`window_id`](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.input%2Fproperties%2Fwindow_id)**? = `null` ([string](https://json-schema.org/understanding-json-schema/reference/string "string (JSON Schema)") | [null](https://json-schema.org/understanding-json-schema/reference/null "null (JSON Schema)"))

    Window ID for pane resolution.

  No other arguments are accepted.

  ## Result[#](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.result)

  This server does not advertise an output schema for this tool. Its description defines the returned content.

  ## Annotations[#](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.annotations)

  * [`destructiveHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#destructiveHint)

    `true`

  * [`idempotentHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#idempotentHint)

    `false`

  * [`openWorldHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#openWorldHint)

    `true`

  * [`readOnlyHint`](https://libtmux.org/en/py/stable/mcp/reference/glossary/#readOnlyHint)

    `false`

  ## Protocol data[#](https://libtmux.org/en/py/stable/mcp/tools/capture_pane/#mcp.tool.capture_pane.schemas)

  Use the complete advertised contract for validation and client integration.

  Input schema

  ```json
  {
    "additionalProperties": false,
    "properties": {
      "end": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "End line number."
      },
      "max_lines": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "default": 500,
        "description": "Maximum number of lines to return. Defaults to\n``CAPTURE_DEFAULT_MAX_LINES``. Pass ``None`` to return the\nfull capture with no truncation."
      },
      "pane_id": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Pane ID (e.g. '%1')."
      },
      "session_id": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Session ID (e.g. '$1') for pane resolution."
      },
      "session_name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Session name for pane resolution."
      },
      "socket_name": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "tmux socket name."
      },
      "start": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Start line number. 0 is the first visible line. Negative values\nreach into scrollback history (e.g. -100 for last 100 lines)."
      },
      "window_id": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ],
        "default": null,
        "description": "Window ID for pane resolution."
      }
    },
    "type": "object"
  }
  ```
