Skip to main content
Glama
aazizisoufiane

mcp-python-repl

repl_run_code

Run Python code with persistent variables across calls. Assign data to named variables for later reuse; use 'result' to return output to the caller.

Instructions

Execute Python code with a PERSISTENT namespace.

Variables you assign are STORED and available in subsequent calls. Access them DIRECTLY by name (e.g. my_data, df).

The result variable is ONLY for returning output to the caller. It does NOT persist between calls — use named variables instead.

Correct workflow::

Call 1: data = load_csv("input.csv"); result = f"loaded {len(data)} rows"
Call 2: filtered = [r for r in data if r["active"]]; result = len(filtered)

Returns: JSON with execution result, new/modified variables, and namespace summary.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

The description goes beyond annotations to disclose essential stateful behavior: variables persist across calls, the 'result' variable does not persist, and the tool returns a JSON summary. This is critical context that annotations (readOnlyHint=false, idempotentHint=false) do not provide, and it is explained with a concrete example to prevent misuse.

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 well-structured and front-loaded: it states the core purpose first, then explains the persistence model, illustrates a correct workflow, and ends with return value info. Every sentence contributes to understanding the tool's behavior without unnecessary fluff or repetition of schema details.

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 stateful code-execution tool, the description covers the essential mechanics: persistence, result variable semantics, and return format. It omits session_id handling (covered by schema) and does not discuss error scenarios, but with the provided output schema and workflow example, the overall picture is sufficiently complete.

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?

The tool description adds significant meaning to the 'code' parameter by explaining the persistent namespace and result-variable contract, complementing the schema's brief descriptions. However, it does not mention 'session_id' at all, leaving that parameter's semantics entirely to the schema. The description enriches the main parameter but not the secondary one.

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 executes Python code with a persistent namespace, immediately distinguishing it from siblings like repl_run_file (runs files) and repl_install_package (installs packages). The verb 'Execute' plus the resource 'Python code' and the key behavior 'persistent namespace' make the purpose unmistakable.

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?

The description provides clear guidance on how to use the persistent namespace: assign variables to persist them, use named variables, and reserve 'result' for returning output. It even includes a correct workflow example. However, it does not explicitly mention when to use this tool over alternatives (e.g., repl_run_file) or state exclusions, though sibling names make the distinction obvious.

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/aazizisoufiane/mcp-python-repl'

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