Skip to main content
Glama

Code Execution

code-execute

Execute code in a secure sandbox with pre-configured environments. Returns stdout, stderr, the exit code, the run time, and the files the code wrote to /home/user/output/ as base64. Use for calculations, data processing and running scripts. Each call runs in a fresh sandbox that is destroyed afterwards, so nothing carries over from one call to the next. Cost: 2 credits, charged only when a call succeeds.

Input Schema

NameRequiredDescriptionDefault
codeYesThe code to execute.
timeoutNoMax execution time (1-300s).
languageNoProgramming language.python
templateNoPre-configured environment.default

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing ephemerality ('fresh sandbox... destroyed afterwards, so nothing carries over'), the cost model ('2 credits, charged only when a call succeeds'), and the exact return payload (stdout, stderr, exit code, run time, files written to /home/user/output/). The non-idempotent, non-persistent nature is spelled out rather than left to inference.

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

Conciseness4/5

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

Front-loaded with the core action and return contract, followed by use cases, sandbox lifecycle and cost — every sentence carries information. The sandbox-lifecycle sentence is slightly redundant in phrasing ('fresh sandbox... destroyed' vs 'nothing carries over'), a minor inefficiency.

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

Completeness5/5

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

With no output schema, the description compensates by enumerating the return fields, and it covers the non-obvious traits an agent needs (ephemerality, cost-on-success, output path). For a 4-parameter execution tool this is complete.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents code, timeout, language and template including enum values. The description only alludes to templates ('pre-configured environments') and the output directory, adding little syntax or default detail beyond the schema. Baseline 3 is appropriate.

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?

States a specific verb and resource ('Execute code in a secure sandbox with pre-configured environments') plus the concrete return payload, so the agent immediately knows this is the general-purpose code runner rather than any of the media/data siblings. No sibling overlaps with arbitrary code execution.

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

Usage Guidelines4/5

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

'Use for calculations, data processing and running scripts' gives clear positive context for when this tool is appropriate. It does not, however, name any exclusions or alternatives (e.g. when a dedicated sibling like file-convert or invoice-parse is preferable), so it falls short of the top tier.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.