run_python_script
Execute Python scripts with command-line arguments, environment variables, and working directory options. Captures stdout/stderr and enforces timeouts for safe subprocess handling.
Instructions
Execute a Python script file with arguments. MCP-safe subprocess handling with captured stdout/stderr.
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": {
"script_path": "<script_path>"
},
"name": "run_python_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory (default: script's directory) | |
| env | No | Additional environment variables | |
| args | No | Command-line arguments to pass to script | |
| timeout_ms | No | Timeout in milliseconds (default: 30000, max: 300000) | |
| script_path | Yes | Path to Python script |