execute_code
Run code in an isolated sandbox with persistent state across calls, supporting Python, Node.js, and R for interactive development.
Instructions
Executes code in the sandbox. State persists across calls (like Jupyter cells).
Args:
session_id: ID returned by create_session.
code: Code to execute (Python, Node.js, or R, depending on the session runtime).
timeout: Max execution time in seconds (max 300). Defaults to 30.
Returns:
JSON with success, stdout, stderr, result, error, and display_outputs.
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": {
"session_id": "<session_id>",
"code": "<code>"
},
"name": "execute_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | ||
| code | Yes | ||
| timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||