Skip to main content
Glama

run_user_code

Executes user-submitted Python code locally against provided test cases to verify function behavior and return pass/fail results.

Instructions

Run user-submitted Python code against test cases locally

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesUser's Python code
languageNoLanguage (only 'python' supported currently)
testCasesYes
timeoutMsNoTimeout in milliseconds (default 5000)
functionNameYesName of the function to test

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.1

TDQS

C2.9/5.0
Behavior2/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 of behavioral disclosure. It mentions local execution, but does not describe what happens after execution, whether code is sandboxed, what output is returned, how timeouts behave, or any safety limitations.

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 a single, front-loaded sentence with no filler or repetition. Every word earns its place, and the core action and resource are immediately clear.

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

Completeness2/5

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

For a tool that executes arbitrary user code, the description is under-specified. It lacks information about return values, execution environment, isolation, failure handling, and the effects of timeoutMs. The absence of an output schema and annotations makes these gaps more significant.

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 high (80%), so the parameters are mostly documented in the schema itself. The description adds little beyond restating that the tool runs Python code and uses test cases, but it does not meaningfully clarify parameter semantics beyond what the schema already provides.

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?

Description states a specific verb ('run'), a specific resource ('user-submitted Python code'), and the context ('against test cases locally'). It is clear and unambiguous, but it does not explicitly differentiate from sibling tools like generate_test_cases.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus the alternative tools. There is no mention of when code execution is appropriate, when it isn't, or which sibling should be used instead.

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