Skip to main content
Glama
ansys

Ansys CFX-MCP

Official
by ansys

run_code

Directly execute Python code within the active CFX session to access session variables and helpers, capturing stdout, stderr, and the return value.

Instructions

Execute Python code against the active PyCFX session namespace. The code runs with pre, solver, post, session, cfxpre, cfxsolver, and cfxpost helpers refreshed from the current CFX sessions. Returns stdout, stderr, and any __return__ value. Prefer cfx_workflow or cfx_model_context for routed actions and read-only queries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesPython source code submitted for validation, grounding, or execution.
Behavior4/5

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

With no annotations provided, the description carries full transparency burden. It discloses the execution namespace, the list of refreshed helper variables, and the return value (stdout, stderr, __return__). It also hints at which operations are not appropriate, but does not detail side effects or safety implications of arbitrary code execution.

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, each with purpose: first states the core action, second details helpers and return, third gives alternative guidance. No wasted words, information is front-loaded.

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?

Given the complexity of code execution and no output schema, the description covers the essential behavior, execution context, return values, and offers routing guidance. It stops short of describing potential side effects or the exact signatures of helpers, but the core is sufficiently complete for an agent to select and invoke it correctly.

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% and the 'code' parameter is described, so baseline is 3. The description adds meaning beyond the schema by explaining the execution environment (helpers refreshed from CFX sessions) and the return format. However, the schema mentions 'validation, grounding, or execution' while the description only says 'execute,' creating slight ambiguity about whether validation/grounding modes exist.

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+resource: 'Execute Python code against the active PyCFX session namespace.' This clearly distinguishes it from siblings like cfx_workflow and cfx_model_context by explicitly naming them as preferred for routed actions and read-only queries.

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 provides clear context for use (executing code in a session) and explicitly directs users to prefer cfx_workflow or cfx_model_context for routed actions and read-only queries. This gives effective alternative guidance, though it could be more explicit about exactly when run_code is the best choice.

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/ansys/pycfx-mcp'

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