Run Shell Command
run_commandExecute a shell command with interactive user approval. Captures stdout, stderr, and exit code with configurable timeout.
Instructions
Execute a shell command and return its stdout/stderr. ALWAYS requires interactive user approval before running.
Args:
command (string): The command to execute (interpreted by the platform shell — cmd.exe on Windows, bash on Linux).
cwd (string, optional): Working directory. Defaults to the first allowed directory.
timeout (number, optional): Timeout in milliseconds. Default: 30000, max 300000.
Returns: stdout, stderr, and exit code.
Error Handling:
Returns an error if the user declines the approval prompt.
Returns an error if the command exceeds the timeout (process is killed).
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": "run_command"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory for the command | |
| command | Yes | Shell command to execute | |
| timeout | No | Timeout in milliseconds |