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

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

All Python tools · JSON · Source

Arguments

end optional
End line number.

Default: null.

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

Default: 500.

pane_id optional
Pane ID (e.g. '%1').

Default: null.

session_id optional
Session ID (e.g. '$1') for pane resolution.

Default: null.

session_name optional
Session name for pane resolution.

Default: null.

socket_name optional
tmux socket name.

Default: null.

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

Default: null.

window_id optional
Window ID for pane resolution.

Default: null.

Schemas

The schema defines required fields, nested values, defaults, and validation constraints.

Input schema
{
"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"
}
Tool annotations
{
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false
}
Esc

Type to search.