terminal_exec
Executes a one-shot non-interactive command in PowerShell, pwsh, cmd, bash or sh and returns its output, exit code and timeout status, saving oversized output to a file.
Instructions
Run a one-shot command to completion and return its output and exit code.
Use this for non-interactive commands. Use terminal_start + terminal_send for programs that need input, a TUI, or a persistent shell.
Args:
command: Command line to execute.
shell: "powershell", "pwsh", "cmd", "bash" or "sh".
cwd: Working directory. Defaults to the server's current directory.
env: Extra environment variables.
timeout_ms: Kill the command after this long.
max_chars: Maximum output characters returned. The full output is written to a
temporary file when it is longer; its path is returned as output_file.
Returns: output, output_file, total_chars, exit_code, timed_out, duration_ms, truncated.
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": {
"command": "<command>"
},
"name": "terminal_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| env | No | ||
| shell | No | ||
| command | Yes | ||
| max_chars | No | ||
| timeout_ms | No |