Skip to Content

exec_run

Run one command on the machine and wait for it: exit code, stdout and stderr apart, whether it timed out. A non-zero exit is a normal result, not an error. Default timeout 120 s (at most 600); on timeout the whole process group is stopped. Output keeps the last 64 KiB of each stream; longer output is saved to stdout_file / stderr_file. The command gets a small base environment (PATH, HOME, USER, SHELL, the locale, the desktop session) plus env; nothing else of cmdop’s own environment reaches it. For long or interactive work use task_start instead.

Arguments

Over MCP every tool also takes machine: the machine’s name or id, optional when only one machine is online.

NameTypeRequiredMeaning
argvstring[]noProgram and arguments, run directly without a shell. Give this or command.
commandstringnoA shell command line, run as /bin/sh -c <command>. Give this or argv.
cwdstringnoWorking folder. Default: the user’s home folder.
envobjectnoExtra environment variables for this command. Default: {}.
stdinstringnoText written to the command’s standard input, then closed. Default: no input.
timeout_secsintegernoSeconds before the command is stopped (default 120, at most 600).

Result

NameTypeRequiredMeaning
cancelledbooleanyesStopped because the call was cancelled.
duration_msintegeryes
exit_codeintegernoExit code; absent when the command was ended by a signal.
signalintegernoThe signal that ended it (Unix).
stderrstringyesThe end of standard error, at most 64 KiB.
stderr_filestringnoWhen stderr was longer than 64 KiB: a file on the machine with all of it (up to 100 MiB), readable with fs_read.
stdoutstringyesThe end of standard output, at most 64 KiB, as text (invalid UTF-8 replaced).
stdout_filestringnoWhen stdout was longer than 64 KiB: a file on the machine with all of it (up to 100 MiB), readable with fs_read.
timed_outbooleanyesStopped because it ran longer than timeout_secs.
truncatedbooleanyesOutput was longer than what is returned; the whole of it is in the files below.

Examples

{ "name": "exec_run", "arguments": { "machine": "<machine>" } }

Limits

The call times out after 620 s (timed_out). Available since version 0.0.1. A refused or failed call returns one of the error codes.