read_session_output
Read an iTerm2 session’s screen output, returning only new lines by default or the last N lines with scrollback to monitor terminal activity and optionally filter results by regex.
Instructions
Read an iTerm2 session's screen. mode 'new' (default) returns only lines not already returned for this session; 'tail' returns the last N lines (scrollback included).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| grep | No | Only return lines matching this regex (case-insensitive). | |
| mode | No | default 'new' | |
| lines | No | Lines for mode 'tail', or first read of a session (default 40). | |
| max_chars | No | Cap on returned text, keeping the most recent (default 6000). | |
| session_id | No | Session ID from list_iterm_sessions. Optional: defaults to the last session used. |