run_command
Execute shell commands on a Raspberry Pi through Connect's remote shell, returning output and exit code; persistent sessions keep directory and environment changes between calls.
Instructions
Run a shell command on a device through its Connect remote shell and return output + exit code. The shell session persists between calls (cwd, env vars). First call to a device takes ~30s to connect. Commands that wait for input (sudo password, editors, confirmations) will time out; use send_keys/read_screen for those.
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": {
"device": "<device>",
"command": "<command>"
},
"name": "run_command"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device | Yes | Device name (or unique substring of it) or device UUID, as shown by list_devices | |
| command | Yes | Shell command line (bash) to run | |
| timeout_sec | No | Max seconds to wait for completion |