Skip to main content
Glama
PortPro-Technologies-Inc

MCP Python Interpreter

run_python_code

Execute Python code in a specified environment, save results, and manage workflows. Ideal for code testing, development, and automation tasks.

Instructions

Execute Python code and return the result. Code runs in the working directory.

Args:
    code: Python code to execute
    environment: Name of the Python environment to use (default if custom path provided, otherwise system)
    save_as: Optional filename to save the code before execution (useful for future reference)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
environmentNodefault
save_asNo
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral details. It mentions code runs in the working directory and environment selection, but lacks critical information like security implications, timeout limits, error handling, or output format. This is inadequate for a code execution tool with mutation potential.

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?

The description is appropriately sized and front-loaded with the core purpose. The Args section is structured but slightly verbose; every sentence adds value, though it could be more streamlined (e.g., merging the working directory note).

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?

Given the tool's complexity (code execution with potential side-effects), no annotations, no output schema, and 0% schema coverage, the description is incomplete. It misses critical details like return value structure, error cases, safety warnings, or execution constraints, making it insufficient for safe agent use.

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 must compensate. It adds meaningful context for all three parameters: 'code' as Python code to execute, 'environment' with default behavior explained, and 'save_as' with its utility. This goes beyond the bare schema, though it could detail environment options or save_as format.

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?

The description clearly states the tool's purpose as 'Execute Python code and return the result', which is specific (verb+resource) and distinguishes it from siblings like run_python_file. However, it doesn't explicitly differentiate from all siblings (e.g., install_package might also execute code indirectly).

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?

The description provides no guidance on when to use this tool versus alternatives like run_python_file or other siblings. It mentions the working directory and environment but doesn't explain scenarios where direct code execution is preferred over file-based execution or other tools.

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/PortPro-Technologies-Inc/mcp-python-interpreter'

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