Read terminal output
terminal_readCaptures a terminal session's visible screen and recent scrollback, optionally waits for a regex prompt or marker, strips ANSI escapes, and can capture full tmux history.
Instructions
Capture the visible screen and recent scrollback of a terminal session. Use expect with a regex to wait until a prompt or marker appears; if it does not match within timeout_ms, the result has expect_matched=false and timed_out=true. ANSI escapes are stripped by default. full_history=true captures the whole tmux history.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ansi | No | Keep ANSI escape sequences. Default false. | |
| lines | No | Scrollback lines to capture. Default 120. | |
| expect | No | Regex to wait for in the captured output. | |
| session | Yes | Session name. | |
| wait_ms | No | Wait before the first capture. | |
| timeout_ms | No | Expect polling timeout. Default 10000. | |
| full_history | No | Capture the entire tmux history. Default false. | |
| join_wrapped | No | Join wrapped lines (tmux -J). Default false. |