Skip to main content
Glama

ipython

Run Python in a persistent kernel to keep variables, imports, cwd, environment, and async tasks across calls; detach long-running cells and collect output, interrupt, or restart later.

Instructions

Run Python in a persistent kernel. Variables, imports, cwd, os.environ and asyncio tasks persist across calls. Top-level await works; the last expression is shown as Out[N]. Each reply ends with [env: ...] listing your live names. Helpers: bash(cmd, timeout=600) starts a shell command in the background and returns a handle h: h.running, h.tail(n), h.output() (waits for exit), await h, h.wait(), h.kill(). env() lists all names; save(name)/load(name) snapshot variables to disk; reset() deletes them. A cell still running after timeout (default 45s, max 600s) keeps running detached and the call returns. Then: code "" waits and collects its output (and any background output); "%interrupt" stops it; "%restart" kills the kernel (state lost); "%status" shows kernel, running cell and bash jobs. New code is refused while a cell runs. Output is capped at ~30000 chars (head and tail kept): print slices, counts or summaries of large data, not whole objects.

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": "ipython"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesPython source, or "" / "%interrupt" / "%restart" / "%status"
timeoutNoSeconds to wait before detaching (default 45)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses state persistence across calls, the detach-on-timeout behavior (default 45s, max 600s, cell keeps running), the ~30000-char output cap that keeps head and tail, kernel state loss on restart, and the full bash helper lifecycle (h.running, h.tail, h.output, await h, h.wait, h.kill). These are exactly the non-obvious behaviors an agent would otherwise get wrong.

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?

Front-loaded with the core statement, then blocks for helpers, detachment handling, and output capping. Every sentence carries information, but the helper enumeration and control-string list are packed densely enough that scanning takes effort; a short bullet structure would read faster.

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?

This is a stateful, long-running execution tool with no annotations and no output schema, so the description must explain lifecycle and failure modes itself — and it does: persistence, timeouts, detached cells, interruption, restart-induced data loss, and output truncation. Nothing an agent needs to invoke it correctly 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 schema already documents both parameters; the description adds real value on top by explaining what detachment means for the timeout parameter and stating the 600s maximum, plus the semantics of each magic control string. It slightly exceeds the baseline because it explains consequences rather than just types.

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?

Opens with a specific verb and resource: 'Run Python in a persistent kernel.' The persistence scope (variables, imports, cwd, os.environ, asyncio tasks) and the Out[N] display convention make the tool's identity unambiguous, and there are no siblings to disambiguate from.

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 gives explicit conditional guidance for each mode: use code "" to wait and collect output from a detached cell, "%interrupt" to stop it, "%restart" to kill the kernel (with the warning that state is lost), "%status" to inspect kernel/bash state. It also states the exclusion rule directly: 'New code is refused while a cell runs.'

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

Deploy Server

Other Tools