guest_command
Run commands and manage files on a VM via the QEMU guest agent.
This tool provides direct access to VMs without SSH — it uses the QEMU guest agent to execute commands, read/write files, and manage systemd services. The VM must be running and have the guest agent installed.
Use this for server administration, configuration, debugging, and automation tasks on VMs managed by OpenFactory.
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": {
"vm_name": "<vm_name>"
},
"name": "guest_command"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path for `file_read` or `file_write`. | |
| type | No | Preferred structured action type. Supported values: `ping`, `exec`, `file_read`, `file_write`, `systemd_status`, `systemd_action`. | |
| action | No | Legacy JSON action object. Preferred usage is the structured fields below (`type`, `command`, `script`, etc.). Supported types: {"type": "ping"} — Check if guest agent is available {"type": "exec", "command": "ls -la /tmp"} — Run a shell command (optional: "timeout": 60) {"type": "exec", "script": "#!/bin/bash\nset -e\nwhoami\npwd"} — Run a multiline bash script without client-side shell escaping {"type": "file_read", "path": "/etc/hostname"} — Read a file from the VM {"type": "file_write", "path": "/tmp/hello.txt", "content": "hello world"} — Write a file {"type": "systemd_status", "service": "sshd"} — Get service status {"type": "systemd_action", "service": "sshd", "action": "restart"} — Start/stop/restart/enable/disable a service Examples: {"type": "exec", "command": "df -h"} {"type": "file_write", "path": "/tmp/test.sh", "content": "#!/bin/bash\necho hello"} {"type": "systemd_status", "service": "nginx"} | |
| script | No | Multiline bash script for `type="exec"`. The server stages it in the guest and runs it, which avoids nested JSON and shell escaping. | |
| api_key | No | Your OpenFactory MCP API key (optional) | |
| command | No | Shell command for `type="exec"`. Use `script` instead for multiline or complex shell work. | |
| content | No | Text content for `type="file_write"`. | |
| service | No | Systemd service name for `systemd_status` or `systemd_action`. | |
| timeout | No | Timeout in seconds for `type="exec"` or the legacy JSON action. | |
| vm_name | Yes | VM name or UUID to run the guest-agent command on. For a build goal this is the of-test-* VM that booted your image: use the vm_name returned by resume_test_environment, or vms[].vm_name / environment.snapshot.vm_name from get_test_results. | |
| content_b64 | No | Base64-encoded file content for `type="file_write"`. Use this when you need exact bytes. | |
| session_token | No | Session token from a previous tool response | |
| service_action | No | Service action for `type="systemd_action"`: `start`, `stop`, `restart`, `enable`, `disable`, or `reload`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||