Skip to main content
Glama

run_python

Run a short Python program in an isolated sandbox and get back exit code, stdout, stderr, duration and up to 3 artifact files from ./out/. Python 3.12 + numpy/pandas/requests, no network, 512 MB, 30 s max, 32 KB code, 4 input files of 256 KB. Free compile-only syntax check first at POST /api/v1/run-python/validate. $0.05/call (one run) via x402. Free syntax check: POST /api/v1/run-python/validate. Free worked example: GET /api/v1/run-python/example.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoCommand-line arguments (sys.argv[1:]), at most 16.
codeYesPython 3 program source, at most 32 KB. Runs as main.py in an empty working directory.
filesNoUp to 4 input files written into the working directory before the run.
stdinNoText piped to the program on standard input (at most 32 KB).
timeout_sNoWall-clock limit for the program in seconds (default 15, max 30).

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

The description discloses that the sandbox is isolated and has no network, implying no external side effects. It also states the cost and time limits, making the tool's behavior transparent. No contradictions with any annotations are present.

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

Conciseness3/5

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

The description contains redundancy, repeating the free syntax check endpoint and listing limits twice. It is organized but could be more concise without losing essential information.

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?

It covers the environment, limits, cost, and expected output components, but lacks an explicit output schema. The enumerated return fields (exit code, stdout, stderr, duration, artifacts) are sufficient for an agent to understand the result, though more detail on artifact encoding would improve completeness.

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?

All five parameters are described in the schema with clear explanations, and the description adds relevant context such as Python 3.12 with numpy/pandas/requests and file size limits. This fully clarifies parameter usage beyond the 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 tool's purpose: running a short Python program in a sandbox and returning exit code, stdout, stderr, duration, and artifacts. It also specifies the Python version and libraries, making it distinct from other sibling tools like inference or echo.

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?

It provides constraints (no network, 512 MB, 30 s max, 32 KB code) and cost ($0.05/call) to guide usage. However, it does not explicitly state when to prefer this tool over alternatives, though the free syntax check endpoint offers a validation pathway.

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.