Skip to main content
Glama

ipython_run

Execute Python code in a named IPython session and obtain the exact terminal output, including exception tracebacks. Supports IPython magics and configurable timeouts.

Instructions

Run code in a session and return the output transcript, exactly as a terminal would show it. A Python exception is a normal result: you get the traceback. Executions within a session are strictly serial, so a second call while one is running is rejected. On timeout the cell is interrupted and you get the partial output. Do not hold long-running work in a cell -- start it in a thread from your own code. This is a real IPython shell: use obj? and obj?? for signatures and source, %whos to list the namespace, and %history for past input.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesCode to execute. May span multiple lines and use IPython magics.
nameYesSession to run in.
timeout_msNoInterrupt the cell after this long. Default 30000, maximum 600000.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden. It discloses traceback-on-exception, terminal-like output, serial execution rejection, timeout interruption with partial output, and IPython-specific behaviors like `obj?`, `%whos`, and `%history`.

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 concise, front-loaded, and every sentence adds essential operational information without redundancy or filler.

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?

For a code-execution tool with no output schema and no annotations, the description fully covers return format, error behavior, concurrency, timeout semantics, and long-running work guidance. Nothing critical is missing.

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 the baseline is 3. The description adds extra meaning by explaining timeout behavior (interruption and partial output) and reinforcing that code may use IPython magics across multiple lines.

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 states a specific verb and resource: 'Run code in a session and return the output transcript.' It clearly distinguishes itself from lifecycle siblings like ipython_start, ipython_stop, and ipython_status by focusing on execution and output.

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?

It gives explicit constraints on usage: executions are serial, a second call while running is rejected, and long-running work should be threaded rather than kept in a cell. It does not explicitly name alternatives among siblings, so it stops short of a 5.

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