execute_command
Run non-interactive shell commands on an authorized remote device and wait for completion, enabling agents to perform one-off operations without an SSH daemon.
Instructions
Run a non-interactive shell command on the selected authorized target device and wait for completion. This can modify or delete files and perform any operation allowed to the target user; obtain user approval for destructive commands. client_token is required with management access (including stdio and no-password mode); client_id is required for multi-device tokens. Each call starts a fresh shell: set cwd and env explicitly; changes do not persist between calls. timeout_ms defaults to 60000 (60 seconds), 0 disables the timeout, and the maximum is 86400000 (24 hours). Captured stdout and stderr share a 1 MiB limit; excess output is discarded and truncated=true. The result contains stdout, stderr, exit_code, timed_out, canceled, truncated and optional error; a nonzero exit, timeout, cancellation or execution failure sets isError. Canceling the MCP request sends a best-effort cancellation request; it does not undo effects already performed. Commands are not automatically retried. Use session_start/read/write/stop for prompts, incremental output or long-running jobs.
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 |
|---|---|---|---|
| error | No | Optional execution or connection error. A disconnect does not prove the remote process completed successfully. | |
| stderr | Yes | Captured standard error, sharing a 1 MiB combined limit with stdout. | |
| stdout | Yes | Captured standard output, sharing a 1 MiB combined limit with stderr. | |
| canceled | Yes | True only when the target reported cancellation; a disconnect alone does not confirm cancellation. | |
| exit_code | Yes | Reported process exit code: 0 means success; -1 means execution failed, was interrupted, or the device disconnected before a normal exit report. | |
| timed_out | Yes | True if the target reported that the process execution timeout elapsed. | |
| truncated | Yes | True if output exceeded the 1 MiB retention limit. Commands discard excess captured output; sessions discard older buffered bytes. |