Skip to main content
Glama

diana_execute

Run Python code in the live DianaIE session to automate DIANA workflows, persist state across calls, and return stdout, stderr, and expression results with traceback on errors.

Instructions

Run Python code inside the live DianaIE session (DianaIE's embedded Python 3.7, GUI thread).

DIANA script commands are globals and state persists across calls. Returns stdout, stderr and the repr of the final expression's value; a Python exception becomes a tool error with the traceback. Never call pause() or anything that opens a dialog (it blocks until the user closes it). newProject, openProject, importModel and closeProject discard unsaved changes. setParameter needs the path below the item's model directory (diana_parameters shows it) and returns False, changing nothing, for other forms.

Args: code: Python 3.7 source. Use absolute paths. timeout_seconds: how long to wait for DianaIE to finish; raise it for meshing or solver runs.

Input Schema

NameRequiredDescriptionDefault
codeYes
timeout_secondsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.10.0

TDQS

A4.4/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 and does so unusually well: state persists across calls, DIANA commands are globals, stdout/stderr plus the final expression's repr are returned, and exceptions surface as tool errors with tracebacks. It also names the calls that discard unsaved changes (newProject, openProject, importModel, closeProject) and the blocking hazard of dialogs and pause(), which is exactly the destructive/irreversible context an agent needs.

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 action and runtime context, then safety warnings, then an Args section that maps cleanly to the parameters. Every sentence carries substantive information, though the mid-paragraph list of destructive commands and the setParameter qualification make it a dense block that could be broken up for scanability.

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 high-risk, high-complexity tool with no annotations, and the description covers the essential gaps: mutation hazards, state persistence, error behavior, blocking calls, and one parameter-specific quirk. A return-value section is not strictly required given the output schema exists, yet the description still summarizes outputs, so nothing an agent needs in order to invoke it safely 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 0%, so the description must compensate, and it defines both parameters: code as Python 3.7 source with a preference for absolute paths, and timeout_seconds as the wait for DianaIE to finish with the instruction to raise it for long-running meshing or solver calls. Minor gap: no unit is stated for timeout_seconds, though the schema default of 300 implies seconds.

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?

States a precise verb and resource: run Python code in the live DianaIE session, with the runtime pinned as embedded Python 3.7 on the GUI thread. The agent can distinguish this general execution escape hatch from siblings like diana_solve or diana_run_solver without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete use guidance in fragments: raise the timeout for meshing or solver runs, use absolute paths, and consult diana_parameters for the model-directory path. However, it never tells the agent when to prefer a specialized sibling (diana_solve, diana_run_solver) over raw code execution, nor any explicit when-not-to-use condition beyond the dialog warning.

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