session_start
Start an interactive terminal session on an authorized target device to run shell commands, answer prompts, and collect incremental output.
Instructions
Start a new interactive terminal process on an authorized target device. The command can change files or system state with the target user's permissions. Supply client_id for multi-device tokens; set cwd and env for this new process. timeout_ms defaults to 0 (no timeout), with a maximum of 86400000 (24 hours). Returns session_id and the initial byte cursor 0, not command completion. Repeated calls start separate processes. Use session_read with the last next_cursor to collect incremental output until done=true, session_write to answer prompts (include a newline), and session_stop to cancel. Each token retains up to six sessions, and only the latest 1 MiB of each session's output is retained. Finished history expires after 30 minutes or can be evicted by later sessions; keep the session_id and poll promptly. Server restarts invalidate sessions. For a short non-interactive command with a final stdout/stderr result, use execute_command instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory on the target device. Each command starts a fresh shell; use cwd for subsequent commands instead of relying on a previous cd. | |
| env | No | Environment overrides for this command, merged with the client environment. Values must be strings. | |
| command | Yes | Shell command | |
| client_id | No | Six lowercase letters or digits from list_clients. Required for multi-device tokens, even when only one device is online; optional for single-device tokens. | |
| timeout_ms | No | Execution timeout in milliseconds, up to 86400000 (24 hours). 0 disables the timeout. Default: 60000 for execute_command, 0 for session_start. | |
| client_token | Yes | Target client connection token, required with management access (including stdio and no-password mode). Device-scoped bearer access implicitly selects its own token. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | Yes | Initial output byte cursor, always 0 for a new session. | |
| session_id | Yes | Identifier of the owned session; retain it for subsequent read, write and stop calls. |