Run a Command on a Virtual Machine
run_vm_commandRun a shell command on a running virtual machine over its serial-over-SSH console, and return the console output. Use this for one-time in-guest setup — e.g. partitioning and formatting an attached data volume, then mounting it, or configuring networking.
The VM must be RUNNING (start it with cycle_control_virtual_machine first). This connects to the guest's SERIAL CONSOLE through the Cycle gateway — it does not use the VM's network — and logs in with the guest's own credentials: username defaults to 'root', and the password defaults to the VM's generated root password when that is still retrievable (~10 minutes after creation). After that window you MUST pass 'password' (and 'username' if not root); this tool never guesses or stores credentials. If nobody has the guest password any more, reconfigure_virtual_machine can set a new one. Because a serial console is a real tty, the guest echoes input, so the returned output includes some command echo — read it as a console transcript, not clean stdout.
This runs an arbitrary command as root inside the guest — it is powerful and mutating. Always call with preview:true first: it echoes the target and command and makes NO connection, so the user can confirm intent. Confirm with the user, then call again without preview. Never run a command without explicit confirmation. Make destructive commands idempotent where possible.
Serial credentials are minted for the run and expired immediately after. For a human who wants to drive their own interactive session instead, use get_vm_console_access — it returns an ssh command they run themselves; this tool is for programmatic one-shot commands.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Shell command to run in the guest, e.g. 'mkfs.ext4 /dev/vdb && mkdir -p /mnt/data && mount /dev/vdb /mnt/data'. | |
| context | No | Why are you calling this tool? Briefly describe the user's goal. | |
| preview | No | When true, echo the target + command and make NO connection. Use it to confirm intent with the user. Always run this first. | |
| password | No | Guest login password. Optional while the VM's generated root password is still retrievable (~10 min after creation); required after that, or when logging in as a non-root user with a different password. | |
| username | No | Guest login username. Defaults to 'root'. | |
| environment | Yes | Environment the VM lives in. | |
| conversation_id | No | Conversation tracking id. Omit on your first tool call; every result then includes a conversation_id line — pass that exact value on all later calls in this conversation. | |
| timeout_seconds | No | Max seconds to wait for login plus command, 1-60 (default 45). 60 is the ceiling because a longer block dies at the MCP transport before this tool can report. A genuinely slow command (e.g. mkfs on a large volume) may outlast the wait — it keeps running in the guest, so re-run a cheap check command afterwards to confirm it finished rather than raising the timeout. | |
| virtual_machine | Yes | VM to run on. |