Read Terminal Output
read_terminal_outputRead a terminal session's captured output, with escape codes removed and progress bars collapsed. Optionally wait for the output to stabilize before returning, ensuring command results are ready.
Instructions
Reads a session's captured output transcript: everything the shell has printed since the session opened, with terminal escape/color codes stripped and carriage-return line-rewrites (progress bars, spinners) collapsed to their final state.
Args:
session (string): which session to read (default "default")
lines (number): trailing lines to return, 0 = everything captured so far (default 0)
waitForIdleMs / timeoutMs: optionally wait for output to stop changing (a heuristic for "the command probably finished") before returning; without this the call returns immediately with whatever has been captured so far
Returns: { text, truncated, idleReached, timedOut }. Long output is truncated from the start (oldest lines dropped first) to maxOutputChars (see config.json); truncated is true when that happened.
Note: this is a plain-text transcript, not a full terminal screen emulation - a full-screen app (vim, htop) that repaints the same screen region repeatedly will show as a scrolling log of each repaint, not one clean frame.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | No | How many trailing lines of visible output to return. 0 (default) returns everything currently visible/scrolled-into-view. | |
| session | No | Session name to read from. | default |
| timeoutMs | No | Max total time to spend polling when waitForIdleMs > 0. | |
| waitForIdleMs | No | If > 0, poll the terminal until its visible text stops changing for this many ms (useful for waiting until a command likely finished), up to timeoutMs. |