Skip to main content
Glama

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
codeYes
timeoutNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses state persistence, the need for a session_id, code execution timeout limits, and the return format. However, it does not detail error handling, isolation, or what happens on invalid session.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, starting with the core behavior (persistent state) and listing parameters in a clean, readable format. Every sentence adds value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (session-based, multiple languages, timeout), the description covers essential aspects like state persistence and return values. However, it lacks guidance on choosing between execute_code and execute_terminal, and could mention error behavior more explicitly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no descriptions (0% coverage), so the description adds significant meaning: session_id is from create_session, code supports multiple languages per runtime, timeout has a maximum of 300 and default of 30. This goes beyond the schema, though language support could be more explicit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it executes code in a sandbox with persistent state, similar to Jupyter cells. It mentions session_id which ties to create_session, but it does not explicitly differentiate from execute_terminal, though the context implies a session-based execution environment.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for running code in a session with persistent state, and gives parameter defaults and limits. However, it does not specify when to use this tool over alternatives like execute_terminal, nor does it provide conditions when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/eduresser/sandbox-agent'

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