execute
Run shell commands on a remote SSH server and retrieve output, errors, and exit codes. Supports working directories, timeouts, dry-run previews, and safety filtering to prevent destructive actions.
Instructions
Execute a shell command on a single SSH server.
Args:
server: Server name (e.g. 'web-prod-01'). Must match a configured server.
Use list_servers to see available servers.
command: Shell command to execute on the remote server (exactly as it
would be typed at a bash prompt). Rejected if it exceeds
max_command_bytes (default 65536 encoded UTF-8 bytes).
timeout: Command timeout in seconds. Default 30. Not range-checked,
and NOT authoritative: a timeout set on the server's entry
in servers.toml overrides this argument outright, so a
per-server 30 wins over a caller-supplied 600.
working_dir: Absolute remote directory to cd into before running the
command. Uses the server's default_dir from servers.toml
if omitted, or the SSH login directory if neither is set.
force: If True, bypass the dangerous-command detection patterns. Use
only for audited bulk operations. The block list is ~25 regexes
and is broader than "obviously destructive": besides rm -rf /,
mkfs, dd-to-disk, chmod 777 /, redirects into /dev/sd* and
/etc/{passwd,shadow,gshadow,sudoers}, find -delete / -exec rm,
shred / wipefs / blkdiscard / sgdisk on /dev/, partition-table
edits, and fork bombs, it also rejects ordinary interpreter
wrappers — bash -c ..., python3 -c ... (also perl/ruby
-c/-e), eval "...", and base64 -d | sh. Harmless
commands in those forms need force=True too. Default False.
dry_run: If True, do NOT connect or execute. Return a preview describing
what would run (server, command, working_dir, timeout, force).
Dangerous-command detection still runs so rejection can be
previewed. Useful for LLM plans that want to validate intent
before committing. Default False.
Returns:
Formatted command execution result with stdout, stderr, and exit code.
Long output is truncated at max_output_bytes (default 50 KiB) PER
STREAM — stdout and stderr get independent budgets, so the combined
worst case is 2x that setting. A truncated stream ends with
[... output truncated at N bytes], and hitting the cap TERMINATES
the remote process rather than letting it keep writing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| force | No | ||
| server | Yes | ||
| command | Yes | ||
| dry_run | No | ||
| timeout | No | ||
| working_dir | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |