vm_exec
Run a program in a virtual machine.
Runs a program in a running machine as a job and returns its exit status and output, up to 16 KiB of each stream; job_output reads the rest. It runs as root unless user names another account, with desktop as the user at the screen, and otherwise in Windows as LocalSystem. With desktop and background it opens an app on the user's desktop that job_cancel ends with what it started. A credential the person granted is in its variable as a placeholder, which OSMates replaces with the value on requests to the credential's hosts; vm_info lists them.
- Profiles
- operator, full
- Read-only
- No
- Destructive
- Yes
- Idempotent
- No
- Open world
- Yes
- Runs as a task
- Optional
Parameters
architecturestringWhich code of a program built for several architectures runs.
One of
arm64,x64.argvarray of stringsRequiredThe program and its arguments. No shell interprets them: pass ["sh", "-c", "..."].
backgroundbooleanReturn the job at once, for a server or a build; default false.
cwdstringWorking directory; default the account's home, C:\, or the user's profile with desktop.
desktopbooleanRun as the user signed in at the screen, on their desktop; user then names the account expected there. Default false.
envarray of stringsVariables to add to the environment, as NAME=value.
stdinstringText for standard input.
timeout_secondsintegerKilled after this long; default 600, none in the background.
From 1 to 3600.
userstringThe guest account to run as; default root; in Windows only with desktop.
vmstringRequiredThe machine's name or identifier, as vm_list shows it.
wait_secondsintegerSeconds to wait before answering with a job to follow; default 20.
From 0 to 30.
Output
The result's structured content is one of these objects.
JSON Schema: /schemas/0/mcp/tools/vm_exec/output.json
running
jobstringRequiredstatestringRequiredOne of
running.
process
exitCodeintegerjobstringRequiredsignalintegerstderrobjectRequiredstderr.bytesintegerRequiredAt least 0.
stderr.encodingstringOne of
base64.stderr.guestDatastringRequiredstderr.shownintegerRequiredAt least 0.
stdoutobjectRequiredstdout.bytesintegerRequiredAt least 0.
stdout.encodingstringOne of
base64.stdout.guestDatastringRequiredstdout.shownintegerRequiredAt least 0.
timedOutbooleanRequiredverificationobjectRequiredverification.evidencestringRequiredverification.statusstringRequiredOne of
verified,unverified,failed.