Skip to main content
Glama
elusznik
by elusznik

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
NameRequiredDescriptionDefault
codeYesPython 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.
serversNoOptional list of MCP servers to make available as mcp_<name> proxies
timeoutNoExecution timeout in seconds

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/elusznik/mcp-server-code-execution-mode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server