read_output
Read output from a terminal session with three modes: wait for output to settle, incremental read from a cursor, or block until a pattern matches. Returns new output and status flags.
Instructions
Read output from a session. Three modes: (1) default: wait for output to settle, (2) since_cursor: incremental read from a cursor position (returns only new output), (3) wait_for: block until a regex pattern matches. Mode 2 response includes has_more (true = more unread data, call again with new cursor) and is_truncated (true = data was overwritten before you read it).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_lines | No | Lines before/after matched line to include (default: 0, max: 50). Only with wait_for. | |
| max_bytes | No | Maximum bytes to return in a single read (mode 2 only). If output exceeds this, has_more=true and you should call again with the returned cursor. Recommended: 32768 (32KB) to avoid large context usage. | |
| session_id | Yes | Session ID to read from | |
| since_cursor | No | Read only output written after this cursor position. Get cursor from previous read_output/send_input/get_session_state responses. | |
| tail_lines | No | On timeout, include last N lines of output (default: 0, max: 100). Only with wait_for. | |
| timeout | No | Max wait time in seconds (default: 5, max: 600) | |
| wait_for | No | Regex pattern to wait for. Falls back to plain text match if regex is invalid. |