execute_commandExecute a command in the specified shell (powershell, cmd, gitbash, bash, wsl)
**IMPORTANT GUIDELINES:**
1. ALWAYS use the `workingDir` parameter to specify the working directory
2. Request config of this MCP server configuration using tools
3. Follow limitations taken from configuration
4. Use validate_directories tool to validate directories before execution
**Shell-Specific Settings:**
**powershell:**
- Command timeout: 30s
- Max command length: 2000 characters
- Injection protection: enabled
- Blocked operators: &, |, ;, `
- Path format: Windows-style (C:\Users\...)
**cmd:**
- Command timeout: 30s
- Max command length: 2000 characters
- Injection protection: enabled
- Blocked operators: &, |, ;, `
- Path format: Windows-style (C:\Users\...)
**gitbash:**
- Command timeout: 30s
- Max command length: 2000 characters
- Injection protection: enabled
- Blocked operators: &, |, ;, `
- Path format: Mixed (C:\... or /c/...)
**bash:**
- Command timeout: 30s
- Max command length: 2000 characters
- Injection protection: enabled
- Blocked operators: &, |, ;, `
- Path format: Unix-style (/home/user, /mnt/c/...)
**wsl:**
- Command timeout: 30s
- Max command length: 2000 characters
- Injection protection: enabled
- Blocked operators: &, |, ;, `
- Path format: Unix-style (/home/user, /mnt/c/...)
- Inherits global Windows paths (converted to /mnt/...)
**Working Directory:**
- If omitted, uses the server's current directory
- Must be within allowed paths for the selected shell
- Must use the correct format for the shell type
**Output Truncation:**
- Output is automatically truncated if it exceeds the configured limit
- Current limit: 20 lines
- Use `maxOutputLines` parameter to override the limit for a specific command
- If truncated, use `get_command_output` tool with the executionId to retrieve full output
- When file logging is enabled (via `logDirectory`), full logs are also saved to disk
**Command Timeout:**
- Each shell has a default command timeout (see Shell-Specific Settings above)
- Use `timeout` parameter to override the timeout for a specific command
- Timeout must be a positive integer between 1 and 3,600 seconds (1 hour)
- If the timeout is exceeded, the command will be terminated
**Examples:**
Windows CMD:
```json
{
"shell": "cmd",
"command": "dir /b",
"workingDir": "C:\\Projects"
}
```
WSL:
```json
{
"shell": "wsl",
"command": "ls -la",
"workingDir": "/home/user",
"maxOutputLines": 50
}
```
With custom timeout:
```json
{
"shell": "wsl",
"command": "long-running-command",
"workingDir": "/home/user",
"timeout": 120
}
```
Bash:
```json
{
"shell": "bash",
"command": "ls -la",
"workingDir": "/home/user",
"maxOutputLines": 50
}
```
Git Bash:
```json
{
"shell": "gitbash",
"command": "git status",
"workingDir": "/c/Projects/repo" // or "C:\Projects\repo"
}
```
With custom output limit:
```json
{
"shell": "gitbash",
"command": "git log --oneline -50",
"workingDir": "/c/Projects/repo",
"maxOutputLines": 100
}
```Input schema{
"type": "object",
"properties": {
"shell": {
"type": "string",
"enum": [
"bash"
],
"description": "Shell to use for command execution",
"enumDescriptions": {
"bash": "bash shell - timeout: 30s - Unix paths"
}
},
"command": {
"type": "string",
"description": "Command to execute. Note: Different shells have different blocked commands and operators."
},
"workingDir": {
"type": "string",
"description": "Working directory (optional). Format depends on shell type:\n- Windows shells: Use C:\\Path\\Format\n- Unix/WSL shells: Use /unix/path/format\n- Mixed shells: Both formats accepted"
},
"maxOutputLines": {
"type": "number",
"description": "Maximum number of output lines to return (optional, overrides global setting). Must be a positive integer between 1 and 10,000."
},
"timeout": {
"type": "number",
"description": "Command timeout in seconds (optional, overrides global setting). Must be a positive integer between 1 and 3,600 (1 hour)."
}
},
"required": [
"shell",
"command"
],
"additionalProperties": false
} | — | | — |
get_command_outputRetrieve the full output from a previous command execution.
Use this tool when command output was truncated and you need to see the complete result.
The executionId is provided in the truncation message of the original command.
Parameters:
- executionId (required): The execution ID from the truncation message
- startLine (optional): 1-based start line (default: 1)
- endLine (optional): 1-based end line (default: last line)
- search (optional): Regex pattern (case-insensitive) to filter lines
- maxLines (optional): Maximum lines to return (default: config value)
Examples:
```json
{ "executionId": "20251125-143022-a8f3" }
```
```json
{ "executionId": "20251125-143022-a8f3", "startLine": 100, "endLine": 150 }
```
```json
{ "executionId": "20251125-143022-a8f3", "search": "error|failed|exception" }
```Input schema{
"type": "object",
"properties": {
"executionId": {
"type": "string",
"description": "Execution ID from a previous command (shown in truncation message)"
},
"startLine": {
"type": "number",
"description": "1-based start line (optional, default 1)"
},
"endLine": {
"type": "number",
"description": "1-based end line (optional, default last line)"
},
"search": {
"type": "string",
"description": "Regex pattern to filter lines (case-insensitive)"
},
"maxLines": {
"type": "number",
"description": "Maximum lines to return (default: config maxReturnLines)"
}
},
"required": [
"executionId"
],
"additionalProperties": false
} | — | | — |
validate_directoriesCheck if directories are within allowed paths (only available when restrictWorkingDirectory is enabled)
**Validation Modes:**
- Global: Validates against server-wide allowed paths (default)
- Shell-specific: Validates against a specific shell's allowed paths
**Shell-Specific Validation:**
Add the "shell" parameter to validate for a specific shell:
```json
{
"directories": ["/home/user", "/tmp"],
"shell": "wsl"
}
```Input schema{
"type": "object",
"properties": {
"directories": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of directory paths to validate",
"minItems": 1
},
"shell": {
"type": "string",
"enum": [
"bash"
],
"description": "Optional: Validate against a specific shell's allowed paths instead of global paths"
}
},
"required": [
"directories"
],
"additionalProperties": false
} | — | | — |