Skip to main content
Glama

mne_run_code

Run custom Python/MNE code in a persistent session with access to loaded data, returning final expression values, captured stdout, and matplotlib figures as PNG paths.

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
Behavior4/5

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

With no annotations, the description fully carries the transparency burden. It discloses the persistent namespace, pre-bound variables, return value of final expression, stdout capture, and PNG saving for matplotlib figures. This gives a solid behavioral model, though it could additionally mention mutation of session state or error handling.

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?

Three sentences, front-loaded with the main action, and each sentence adds distinct value. No redundancy or fluff. The notebook-cell analogy is a concise way to convey behavior.

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?

The description covers execution context, input, behavior, and outputs (return value, stdout, figure paths). It is complete for a generic code execution tool, though the output schema is not detailed in the description (but is provided separately).

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 0%, so the description must clarify the 'code' parameter. It does so thoroughly by explaining what the code should contain, the execution environment, and expected outputs. While lacking explicit syntax examples, it effectively compensates for the missing schema description.

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 arbitrary Python/MNE code in a persistent session namespace, with specific pre-bound names and loaded objects. It distinguishes itself from sibling structured tools by framing itself as a catch-all for anything the structured tools do not cover.

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?

Explicitly says 'Use this for anything the structured tools do not cover,' providing a clear when-to-use directive. It implies structured tools should be preferred for their specific purposes, though it does not name individual alternatives.

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/Exekiel179/MNE-MCP'

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