Skip to main content
Glama
graphgrow
by graphgrow

py_run

Run Python code to transform, aggregate, or generate charts from data frames, with variables and imports persisting between calls. Pass frame handles to recover data after kernel timeouts.

Instructions

EXECUTES Python in the session kernel — pandas, numpy, scipy, matplotlib (Agg), plotly, altair are importable; DATA holds loaded frames; variables and imports survive to your next call. Use it to transform/aggregate before charting, or run a python recipe (matplotlib figures: savefig to an absolute path in the artifact scratch). Resource-capped (memory rlimit + your wall_s, max 570s).

Pass frame_handles as {name: handle} to put stored frames back in DATA before the code runs — this is how you RECOVER after a timeout killed the kernel, and how any call gets a frame it did not load itself. Returns frame_handles for every frame in DATA afterwards, re-addressed if your code changed them, so the next call always has a durable name for the work this one did. You get them back even when the code raises. stdout/stderr come back bounded.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
wall_sNo
frame_handlesNo
Behavior5/5

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

Annotations are all false, so the description carries the burden. It discloses state persistence ('variables and imports survive'), resource limits (memory rlimit, max 570s), return behavior (frame_handles returned even on errors), and output bounding (stdout/stderr come back bounded). This goes well beyond the structured metadata.

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 dense but every sentence adds value—covering purpose, libraries, persistence, resource limits, parameter semantics, and output behavior. It is well-structured into clear paragraphs and uses front-loaded action-oriented language.

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 having no output schema, the description fully explains return values, error behavior, and state management. It provides all needed context for an execution tool, including recovery after timeouts, which is critical in this environment. No gaps remain.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema coverage, the description fully compensates. It explains frame_handles in detail (how to pass and what it returns), wall_s (resource cap with max), and code (available libraries and usage context). Every parameter is given practical meaning beyond the schema.

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 explicitly states 'EXECUTES Python in the session kernel' with a clear verb and resource, and lists exact use cases (transform/aggregate before charting, run a python recipe). This distinguishes it from sibling tools like data_load or chart_spec.

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 provides clear context for when to use ('transform/aggregate before charting, or run a python recipe') but does not explicitly mention when not to use or name alternative tools. Still, the guidance is specific and actionable.

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/graphgrow/root-ext-viz'

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