Skip to main content
Glama

run_code

Execute Python or JavaScript code in a secure sandbox. Install packages via comma-separated list and retrieve stdout, stderr, and error details.

Instructions

Run code in a secure E2B sandbox. Returns stdout, stderr, and any errors.

Args: code: The source code to execute. language: "python" or "javascript" (default: python). packages: Comma-separated list of packages to install (e.g. "pandas,numpy").

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
languageNopython
packagesNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the secure sandbox environment, the returned stdout/stderr/errors, and the ability to install packages via the packages parameter. It provides meaningful behavioral context, though it omits potential limits like network restrictions or timeouts.

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 compact and well-structured, with an opening summary followed by an 'Args:' block. Every sentence adds value without waste, making it easy to parse.

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?

The description covers the core functionality, all parameters, and return values, which is sufficient given the output schema. However, it lacks safety details like timeout behavior or resource limits, which would be useful for a code execution tool.

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

Parameters5/5

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

Schema description coverage is 0%, but the description fully compensates by explaining each parameter. It specifies the 'code' source, the language with valid values and default, and the packages format with an example.

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

Purpose5/5

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

The description uses a specific verb ('Run') and resource ('code in a secure E2B sandbox'), clearly defining what the tool does. The mention of returning stdout, stderr, and errors adds distinctness, though it doesn't explicitly differentiate from sibling 'run'.

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?

Usage context is implied through the description of running code in a sandbox, but no explicit when-to-use or alternatives are mentioned. Sibling tools like 'run' and 'audit_code' are not referenced, so the agent gets no guidance on choosing this over alternatives.

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/YokiiDesu/vending-machine-mcp'

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