Skip to main content
Glama

python_exec

Execute Python code with full system access for data processing, file operations, API calls, and system automation. Returns output and result, with persistent state across calls.

Instructions

Execute Python code with full system access. Returns {success, output, result, error}. Use for: data processing, file operations, API calls, system automation, any Python task. Prefer over js_exec unless JS-specific features needed. UNLOCKED: all imports (os, subprocess, requests, pathlib), file I/O, network access. Persistent state via module-level variables across calls. Limits: 30s timeout (PYTHON_EXEC_TIMEOUT env), 100k chars, 2k lines, 20k AST nodes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython source code. Use print() for output. Last expression value returned in 'result'.
extended_importsNoPre-import numpy/pandas if available. Default: false.
Behavior5/5

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

With no annotations, the description fully covers behavior: full system access, allowed imports, persistent state, limits (timeout, chars, lines, AST nodes). It discloses permissions and constraints comprehensively.

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 extremely concise with no wasted words. It is front-loaded with purpose, then usage, then details, using bullet points for readability.

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

Completeness5/5

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

Despite no output schema or annotations, the description is complete: it covers purpose, usage, behavioral traits, parameter details, limits, and expected output format. It leaves no significant gaps for a code execution tool.

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 coverage is 100%, so baseline is 3. The description adds valuable semantics for the 'code' parameter (use print() for output, last expression returned in 'result'), going beyond the schema. 'extended_imports' is adequately described.

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 'Execute Python code with full system access,' specifying the verb and resource. It lists example use cases (data processing, file operations, etc.) and distinguishes from js_exec, making the purpose highly specific.

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

Usage Guidelines5/5

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

The description explicitly says 'Use for: data processing... any Python task' and 'Prefer over js_exec unless JS-specific features needed,' providing clear guidance on when to use this tool versus alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cutlerbenjamin1-cmd/shell-0'

If you have feedback or need assistance with the MCP directory API, please join our Discord server