Skip to main content
Glama

run_code

Execute a Python snippet in a sandboxed subprocess and return stdout/stderr, so agents can verify code behaves as claimed.

Instructions

Run a Python snippet in a sandboxed subprocess and return its stdout/stderr. Use to check that code does what it claims.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
stdinNo
timeoutNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden. It usefully discloses the execution model ('sandboxed subprocess') and the return channel, but says nothing about isolation limits, network/filesystem access, what happens when timeout is exceeded, or error/exit-code behavior — material facts for arbitrary code execution.

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?

Two tight sentences: the mechanism is front-loaded and the usage hint follows. No filler, no restatement of the name, appropriate size for the tool's complexity.

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

Completeness3/5

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

The output schema covers the stdout/stderr return, so return values need not be re-explained. However a code-execution tool with no annotations, 0% parameter coverage, and unstated sandbox limits/consequences leaves real gaps around timeout, stdin, and failure modes.

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

Parameters2/5

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

Schema description coverage is 0% across three parameters, so the description must compensate and does not. 'Snippet' loosely maps to code, but stdin and timeout (default 5s) are never mentioned, leaving an agent with no idea what stdin feeds or that the timeout is configurable and how it behaves on expiry.

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?

States a specific verb and resource ('Run a Python snippet in a sandboxed subprocess') plus the return channel (stdout/stderr), so the action is unambiguous. It implicitly positions itself as the general-purpose verifier against the narrow siblings (verify_math, check_units), but never names them, so sibling differentiation is left to inference.

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?

'Use to check that code does what it claims' gives one positive usage context. It offers no when-not guidance and never contrasts itself with the specialized siblings (verify_math, test_regex, validate_schema), which is exactly where an agent would hesitate between this tool and a cheaper targeted one.

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