# libtmux_mcp.tools.pane_tools.capture_pane

- **Module:** libtmux_mcp.tools.pane_tools
- **Package:** libtmux-mcp
- **Language:** Python
- **Kind:** function
- **Source:** https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/tools/pane_tools/io.py#L605
- **Page:** https://libtmux.org/en/py/latest/mcp/reference/libtmux_mcp-tools-pane_tools-capture_pane/

```
libtmux_mcp.tools.pane_tools.capture_pane(pane_id: str | None = None, session_name: str | None = None, session_id: str | None = None, window_id: str | None = None, start: int | None = None, end: int | None = None, max_lines: int | None = CAPTURE_DEFAULT_MAX_LINES, socket_name: str | None = None) -> str
```

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

## Parameters

- `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.
- `start` (int | None): Start line number. 0 is the first visible line. Negative values
reach into scrollback history (e.g. -100 for last 100 lines).
- `end` (int | None): End line number.
- `max_lines` (int | None): Maximum number of lines to return. Defaults to
``CAPTURE_DEFAULT_MAX_LINES``. Pass ``None`` to return the
full capture with no truncation.
- `socket_name` (str | None): tmux socket name.

## Returns

str
    Captured pane content as text. When truncated, the first line
    is a ``[... truncated K lines ...]`` marker.
