run_python
Execute Python code in a persistent sandbox environment with state retention between calls, enabling data analysis and multi-tool workflows through MCP server integration.
Instructions
The Code Execution MCP engine. Executes Python code in a stateful, persistent rootless sandbox environment similar to a Jupyter notebook. Variables, functions, and imports are preserved across calls. Use this tool for general code execution, data analysis, or when the user asks to 'run code'. Supports loading additional MCP servers via the 'servers' array.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Python source code to execute. Call runtime.capability_summary() inside the sandbox for this digest. Persistent Python Sandbox (state retained between tool calls). 1. DISCOVER: `runtime.discovered_servers()`, `runtime.search_tool_docs('query')`. Use `discovered_servers(detailed=True)` for descriptions. 2. CALL: `await mcp_server.tool()`. 3. PERSIST: `save_tool(func)` for functions, `save_memory(key, value)` for data. 4. MEMORY: `load_memory(key)`, `list_memories()`, `update_memory(key, fn)`. Run `print(runtime.capability_summary())` for the full manual. | |
| servers | No | Optional list of MCP servers to make available as mcp_<name> proxies | |
| timeout | No | Execution timeout in seconds |