Skip to main content
Glama

Mne Run Code

mne_run_code

Execute custom Python/MNE code in a persistent session to analyze neurophysiology data, run pipelines, and generate figures when structured tools are insufficient.

Instructions

Execute arbitrary Python/MNE code in the persistent session namespace. Pre-bound names: mne, np, pd, plt, plus every object you have loaded (e.g. raw, epochs, evoked, ica). Like a notebook cell: the value of a final expression is returned, stdout is captured, and any matplotlib figures are saved as PNG (paths returned). Use this for anything the structured tools do not cover.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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 provided, the description carries full behavioral disclosure and does so well: it reveals the persistent session namespace, pre-bound names, return of the final expression, stdout capture, and PNG saving of matplotlib figures. These are meaningful execution behaviors beyond the minimal schema, and they set accurate expectations for an arbitrary-code tool.

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 three sentences with no filler. It leads with the core purpose, then immediately provides the most actionable details (pre-bound names, result semantics), and closes with the usage rule. Every sentence earns its place.

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 one-parameter arbitrary-code execution tool with no annotations, the description is remarkably complete: it covers the namespace, the input expectation, the return value, stdout, and figure handling, and it explains when to use the tool relative to the sibling set. An agent has enough context to invoke it correctly without further inference.

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?

Schema coverage is 0%, so the description must explain the `code` parameter, and it does thoroughly. It tells the agent what kinds of code are valid, what names are already in scope, and what side effects/returns to expect from evaluating that code. This adds substantial meaning over the bare `'code': string` 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 opens with a specific verb and resource: 'Execute arbitrary Python/MNE code in the persistent session namespace.' It clearly distinguishes this from the many structured sibling tools by emphasizing it handles anything they do not cover, and it gives concrete pre-bound names (`mne`, `np`, `pd`, `plt`) and object examples (`raw`, `epochs`).

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 explicitly says 'Use this for anything the structured tools do not cover,' which gives a clear routing rule relative to the large sibling set. It also compares execution to a notebook cell, implying an exploratory fallback role. However, it does not name specific alternatives or list common cases where a structured sibling should be preferred instead.

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