Skip to main content
Glama

Run Python or Node.js code

code_run

Run a short program in a fresh sandbox: Python 3.12 (pandas, numpy, scipy, matplotlib, openpyxl, xlsxwriter, pillow, pypdf, python-docx) or Node.js 22 (date-fns, csv-parse, csv-stringify, lodash). Files from the store are in /input (by their names); anything the program writes in its working folder comes back as new files in the store. One CPU, 1 GB of memory, no network (fetch data first with web_read or files_upload). The reply has stdout, stderr (each up to 64 KB), the exit code and the saved files. Costs $0.0001 per started second of run time, at least $0.005 a run ($0.005 for a run under 50 seconds; at most $0.031 a call); nothing if it fails.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "language": "<language>",
      "code": "<code>"
    },
    "name": "code_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesThe whole program.
filesNofile_ids to put in /input.
stdinNo
languageYes
timeout_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior3/5

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

The description carries rich behavior beyond annotations: fresh sandbox per run, 1 CPU / 1 GB, no network, /input mounting of store files, new files returned to the store, stdout/stderr capped at 64 KB, and a precise cost model with floor and ceiling. That's strong; however, it never mentions the timeout_seconds parameter or the default 60s ceiling, which directly interacts with the per-second pricing it advertises — a notable omission on a runtime-bounded tool.

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?

Dense but front-loaded and nearly every clause carries information: environment, I/O contract, limits, then pricing. It is long for a single paragraph, and the parenthetical library lists add bulk, but nothing is filler.

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?

With no output schema, the description does the work of explaining returns (stdout, stderr, exit code, saved files) and the file round-trip contract, which is what an agent most needs. It falls short only on `stdin` and `timeout_seconds`, which change how a call should be composed.

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 coverage is 40%, so the description must compensate. It explains `files` (file_ids appear in /input by name), `language` (Python 3.12 vs Node 22 with library lists), and `code` (the whole program) well. But `stdin` and `timeout_seconds` — both non-trivial — get no mention at all, leaving two of five parameters undocumented anywhere.

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?

Opens with a specific verb and resource: 'Run a short program in a fresh sandbox', then names the two supported runtimes and their preinstalled libraries. No sibling tool in the list does sandboxed code execution, so it is unambiguous against the catalog.

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?

Gives an explicit precondition and alternative for one key constraint: no network, so 'fetch data first with web_read or files_upload'. It also implicitly scopes usage to 'short program' work. What's missing is when to prefer this over data-shaping siblings like rows_query or tables_export.

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.

Resources