Tools and capabilities#
Tool surface#
PyFluent-MCP exposes 22 tools organized into 6 groups:
Group |
Tools |
|---|---|
Connection & session |
|
Schema discovery |
|
Named objects |
|
Execution & validation |
|
Reporting & inspection |
|
Domain tools |
|
Live versus offline tools#
Offline-capable tools work without a live Fluent session:
find_apiandget_helpsearch the bundled settings schema.validate_codeperforms an AST pre-check only.
Live-session tools require PyFluent and a connected Fluent solver:
connect,disconnect,session_status,solver_statusget_state,get_targeted_context, named-object toolsrun_code,summarize_setup,simulation_report,screenshotmesh_quality,list_fields,compare_files
Using the tools#
Discover-validate-execute loop#
For most setup tasks, follow this pattern:
Discover:
find_api("turbulence model")orget_state("setup.general").Validate:
validate_code(python_snippet).Execute:
run_code(python_snippet).Verify:
summarize_setup()orsimulation_report().
Connection management#
Use connect to launch a new Fluent session or attach to an existing one:
“Connect to Fluent and launch a new solver session.”
“Connect to Fluent on 192.168.1.100 port 18500.”
Use session_status to check whether a session is active and disconnect to release
it.
Schema discovery#
Use find_api for ranked path search over the settings tree:
“Find API paths related to boundary condition velocity inlet.”
Use get_state to read live values and list_named_objects to enumerate named
collections (boundary conditions, cell zones, materials, and so on).
Code execution#
run_code executes sandboxed PyFluent Python in a persistent REPL namespace.
This tool mutates the live solver. Always prefer validate_code first for
untrusted code.
validate_code performs an AST and signature pre-check without execution.
Domain tools#
mesh_quality returns live skewness, orthogonal quality, and aspect-ratio
metrics. Route all “show mesh quality / skewness / check mesh” intents here.
list_fields enumerates scalar/vector fields available in the loaded case.
compare_files diffs two case/mesh files in separate ephemeral headless sessions
without touching the live workspace session. Requires the file-probe extra for
.h5/.cas.h5 files.
Workflow examples#
Load a case and inspect setup#
connectlaunches or attaches to Fluent.run_codeloads a case file.summarize_setupgets a compact digest of models, BCs, and materials.mesh_qualitychecks mesh quality metrics.
Generate and apply a settings change#
find_api("under-relaxation pressure")discovers the active path family.get_state("solution.controls")reads the live URF configuration.validate_codethenrun_codeapplies the change.
Compare two case files#
compare_files(path_a="old.cas.h5", path_b="new.cas.h5") returns a structured diff in
separate headless sessions.
Result models and errors#
Tool return types#
Model |
Returned by |
|---|---|
|
|
|
|
Configuration is loaded from FLUIDS_MCP_* environment variables via
load_config(). Use validate_config()
to check the configuration at startup.
Error types#
All errors inherit from FluidsMCPError:
Error |
When raised |
|---|---|
|
A live-session tool is called with no active Fluent connection. |
|
The requested backend kind is not registered. |
|
Tool arguments fail validation. |
|
Schema or API discovery fails |
|
PyFluent or the solver returns an error. |
|
Configuration is invalid. |
Python API#
The package re-exports the server class and shared models from its top-level namespace:
from ansys.fluent.mcp import (
SolveMCP,
ConnectResult,
RunCodeResult,
FluidsMCPConfig,
load_config,
)
Feature reference#
For full API details, including all parameters and return values, see API reference.
Best practices#
For recommendations on using PyFluent-MCP effectively, see Best practices.