Request an invite
Docs menu

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

architecturestring

Which code of a program built for several architectures runs.

One of arm64, x64.

argvarray of stringsRequired

The program and its arguments. No shell interprets them: pass ["sh", "-c", "..."].

backgroundboolean

Return the job at once, for a server or a build; default false.

cwdstring

Working directory; default the account's home, C:\, or the user's profile with desktop.

desktopboolean

Run as the user signed in at the screen, on their desktop; user then names the account expected there. Default false.

envarray of strings

Variables to add to the environment, as NAME=value.

stdinstring

Text for standard input.

timeout_secondsinteger

Killed after this long; default 600, none in the background.

From 1 to 3600.

userstring

The guest account to run as; default root; in Windows only with desktop.

vmstringRequired

The machine's name or identifier, as vm_list shows it.

wait_secondsinteger

Seconds 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

jobstringRequired
statestringRequired

One of running.

process

exitCodeinteger
jobstringRequired
signalinteger
stderrobjectRequired
stderr.bytesintegerRequired

At least 0.

stderr.encodingstring

One of base64.

stderr.guestDatastringRequired
stderr.shownintegerRequired

At least 0.

stdoutobjectRequired
stdout.bytesintegerRequired

At least 0.

stdout.encodingstring

One of base64.

stdout.guestDatastringRequired
stdout.shownintegerRequired

At least 0.

timedOutbooleanRequired
verificationobjectRequired
verification.evidencestringRequired
verification.statusstringRequired

One of verified, unverified, failed.

Report a problem with this page