python
Execute Python code in an isolated Linux VM sandbox. Control timeout and sandbox selection for secure script execution.
Instructions
Execute Python code in the sandbox (python3 is pre-installed in the default mcp-dev image).
Args: code: Python code to execute. timeout: Max seconds to wait (default 30). sandbox: Named sandbox to use (default "default")
Returns: Script output with stdout, stderr, exit code, and execution time.
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": {
"code": "<code>"
},
"name": "python"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout | No | ||
| sandbox | No | default |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |