session_read
Read session output from a byte cursor. Pass command_id to reject reads after a newer command starts. Use status to check completion and drain has_more even after idle or closed.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"session_id": "<session_id>",
"control_token": "<control_token>"
},
"name": "session_read"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Output byte offset, initially 0; subsequent reads accept the previous next_cursor. | |
| wait_ms | No | Wait up to this many milliseconds for output | |
| client_id | No | Device ID from list_client. Required with multi-device tokens for execute_command, session_read, session_control, and p2p_transfer_start. | |
| max_bytes | No | Maximum output bytes per read. The response preserves UTF-8 character boundaries. | |
| command_id | No | Optional command identifier returned by execution; pins reads to that command. New clients generate eight alphanumeric characters; older longer IDs remain accepted. | |
| session_id | Yes | Client-local session identifier. Multi-device calls also require client_id. | |
| control_token | Yes | Control credential in token:key format, required with management access (including stdio and no-password mode). Scoped control bearer access implicitly selects its own token. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | Optional execution or connection error. A disconnect does not prove the remote process completed successfully. | |
| output | Yes | Combined terminal output from the requested cursor; may contain echoed input. | |
| status | Yes | running: terminal busy or stop pending; idle: command ended and shell reusable; closed: client confirmed shell termination. Transport errors do not imply termination. | |
| has_more | Yes | Whether more retained output is available after next_cursor. | |
| exit_code | No | execute/read/list: the latest completed command exit code, preserved when its shell later ends. stop: the confirmed shell termination code. 0 means success; -1 denotes execution failure. Transport errors never invent a code. | |
| truncated | No | Present only as true when the requested cursor predates the oldest retained output. The latest 1 MiB is retained; pagination alone does not truncate. | |
| command_id | Yes | Identifier of the latest command. New clients generate eight case-sensitive alphanumeric characters; older clients may return longer IDs. | |
| session_id | Yes | Client-local session identifier. Multi-device read/control also require client_id. | |
| next_cursor | Yes | Byte offset after the returned output. Pass it as cursor in the next session_read. |