Shell
shellExecute non-interactive terminal commands and return stdout, stderr, and exit code as JSON for tests, type checks, builds, and git tasks.
Instructions
Run a shell command and return its stdout, stderr and exit code as JSON. Use for tests, type checks, builds, git and similar. Do NOT use it to read, write or edit files (use the file tools), for interactive commands (stdin is closed), for commands that never exit (dev servers, watch modes), or for destructive ones (rm -rf, git reset --hard, force pushes) unless the user asked for them. Each call is a fresh process, so cd does not persist: use cwd (default: the server's working directory). The command and any processes it started are killed after timeoutMs. Past 20000 characters stdout and stderr each keep their start and end and omit the middle; binary output is replaced by a short note.
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": "shell"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Directory to run the command in. Defaults to the server's working directory. | |
| command | Yes | The command to run, for example 'ls -lh' or 'git status'. | |
| timeoutMs | No | Kill the command after this many milliseconds. Defaults to 30000; 0 disables the timeout. |