run_code
Execute Python code in a secure sandbox using Jupyter syntax, capturing standard output and errors.
Instructions
Run python code in a secure sandbox by E2B. Using the Jupyter Notebook syntax.
Args:
code: Python code to execute
sandbox_id: Optional sandbox ID to connect to an existing sandbox. If not provided, a new sandbox will be created.
Returns:
JSON string containing stdout and stderr from code execution
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": "run_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| sandbox_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |