terminal_read
Read incremental raw output from an interactive terminal session without duplicates, resuming from a cursor and optionally filtering lines by regex or tail.
Instructions
Read incremental raw output from a session, without duplicates.
Each call returns only what arrived after the previous read. Use the returned
cursor with since to resume from an explicit position.
Args: session_id: Session returned by terminal_start. since: Absolute character offset to read from. Defaults to the last read position. max_chars: Maximum characters returned (head+tail with an explicit omission marker). grep: Keep only lines matching this regular expression. tail: Keep only the last N lines (applied after grep). strip_ansi: Remove ANSI escape sequences.
Returns:
text, cursor (pass as since), dropped, truncated, running, exit_code.
Note: PowerShell (PSReadLine) repaints the current line with cursor movements, so raw output contains fragments. Use terminal_screen for an authoritative view.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| grep | No | ||
| tail | No | ||
| since | No | ||
| max_chars | No | ||
| session_id | Yes | ||
| strip_ansi | No |