Skip to main content
Glama

python

Run code in a fresh subprocess with a configurable timeout and optional background job polling; variables do not persist between executions.

Instructions

Run code in a fresh Python subprocess; variables do not persist. No sandbox. timeout defaults to 60 seconds (maximum 300). run_in_background returns a job_id; poll job_status/job_wait. Output is bounded.

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": {
      "code": "<code>"
    },
    "name": "python"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes
timeoutNo
run_in_backgroundNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Goes well beyond the annotations by disclosing that there is no sandbox, that state is discarded between calls, the timeout default and hard maximum, and that output is bounded. Consistent with openWorldHint=true and readOnlyHint=false. The only shortfall is that 'Output is bounded' never states the actual limit, so an agent cannot size its prints.

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?

Five short clauses, each carrying distinct information, with the most decision-relevant facts (subprocess isolation, no sandbox, timeout) front-loaded. Nothing is repeated from the schema or annotations.

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?

For a 3-parameter execution tool with no output schema, this covers the essential risks: isolation model, lack of sandboxing, time limits, background workflow, and output bounding. It omits execution environment details (Python version, available packages, filesystem/network reach) that an agent would need to write code that succeeds on the first try.

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

Parameters4/5

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

Schema description coverage is 0%, so the description carries the full burden — and it does: it gives the timeout default and cap, and explains that run_in_background yields a job_id to poll. The 'code' parameter is only implicitly defined (Python source), with no note on version, imports, or working directory, so it stops short of full coverage.

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 concrete verb and resource ('Run code in a fresh Python subprocess') and immediately adds the scoping trait that separates it from a persistent interpreter ('variables do not persist'). Against siblings like bash, the Python/subprocess framing makes the resource unambiguous.

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?

Names the follow-up tools for the background mode ('poll job_status/job_wait'), which is genuine routing guidance for one branch. However, it never states when to prefer this over the sibling 'bash' tool or when background execution is warranted versus a blocking call, leaving the main selection decision to inference.

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