ssh_cmd_output
Retrieve captured stdout or stderr from a previously run SSH command by handle_id, enabling progress checks after timeouts or paging through truncated output without rerunning.
Instructions
Retrieve captured output from a command started with ssh_cmd_run, identified by its handle_id. Useful after an io_timeout/wait_timeout to see progress so far - including output produced after that call returned, since background monitoring keeps collecting it - to page through output a response didn't include in full (ssh_cmd_run returns at most the last ~32 KB of each stream inline and says so via output_truncated/output_note), or to re-inspect an earlier command's output without rerunning it.
stdout and stderr are captured in separate buffers, not interleaved - stream
picks which one to retrieve.
The server keeps up to ~2 MB of each stream per command; beyond that the EARLIEST lines are dropped. Asking for a dropped line with start_line gives an error naming the first line still available. For very large output, redirect it to a file (or use ssh_task_launch) and read that instead.
Raises an error if handle_id doesn't exist (e.g. from a previous connection - handles don't survive reconnects).
Returns: A plain list of output lines from the selected stream - not a dict. For total line counts and whether anything was dropped, use ssh_cmd_check_status (output_lines) or ssh_cmd_history.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | No | How many lines to return. Without start_line: the most recent N lines (default 50). With start_line: N lines from there (default 50). | |
| stream | No | Which captured stream to retrieve - stdout (default) or stderr. These are NOT interleaved into one combined stream - call this twice (once per stream) if you need both | stdout |
| handle_id | Yes | Command handle ID - the 'id' field from ssh_cmd_run's response | |
| start_line | No | Page through the output: return lines starting at this line number (1 = the command's first line). Use it to read what a truncated ssh_cmd_run response didn't include (see its output_note). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |