Skip to main content
Glama
feifeigood

code-sandbox-mcp

by feifeigood

run_code

Execute Python code in a secure sandbox using Jupyter syntax, capturing standard output and errors.

Instructions

Run python code in a secure sandbox by E2B. Using the Jupyter Notebook syntax.

Args:
    code: Python code to execute
    sandbox_id: Optional sandbox ID to connect to an existing sandbox. If not provided, a new sandbox will be created.
    
Returns:
    JSON string containing stdout and stderr from code execution

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
sandbox_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains execution in a secure sandbox, the optional connection to an existing sandbox or creation of a new one, and the JSON return containing stdout/stderr. This is substantive, though it doesn't mention potential side effects like sandbox cleanup or persistence.

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 concise and well-structured with Args and Returns sections. Every sentence provides necessary information without fluff, and the most important purpose statement is front-loaded.

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 simplicity (2 parameters, no annotations, output schema exists), the description covers purpose, parameters, and return value adequately. It could be more complete by adding details about sandbox lifecycle or execution environment constraints, but it is sufficient for effective use.

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 coverage is 0%, so the description must fully explain parameters. It does: 'code' is defined as Python code to execute, and 'sandbox_id' is described as optional, with a clear behavioral note that a new sandbox is created if omitted. This adds significant meaning beyond the bare schema.

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 clearly states the specific verb and resource: 'Run python code in a secure sandbox by E2B.' It distinguishes itself from sibling tools like run_command by explicitly targeting Python code with Jupyter Notebook syntax, while create_sandbox/kill_sandbox are lifecycle tools.

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 gives useful context for when to use the tool: to run Python code, and explains the optional sandbox_id behavior. However, it does not explicitly mention when not to use it or point to alternatives like run_command for non-Python commands, leaving usage guidance implied rather than explicit.

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/feifeigood/code-sandbox-mcp'

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