The path_descriptor.py module#
Summary#
Single keyword argument of a Fluent settings command. |
|
One-envelope description of a Fluent settings path. |
Description#
Unified discovery envelope for Fluent settings paths.
Before this module the leaf published four separate probes
(probe_path, get_active_status, get_allowed_values,
describe_named_object_template) plus a couple of higher-level tools
(find_api, get_targeted_context) and every one of them returned
a different payload shape. Validators, recipe grounders, and tool-call
handlers all built their own view of a
path by stitching those envelopes together, and each stitching layer
disagreed with the others on edge cases:
probe_pathreturnedkind='NamedObject'whiledescribe_named_object_templatereturnedchild_class='— callers had to know both.name>' get_allowed_valuesreturned[...]for a bounded enum,Nonefor a free-form string,Nonefor a missing path, and raised for a mode-pruned path. Those threeNonecases had different semantics and the caller had to disambiguate by callingprobe_pathfirst.Commands (
kind='Command') had no unified way to publish their keyword-argument signature; only the live PyFluent backend’sget_command_argumentsaccessor knew them, and it was invoked ad-hoc.
PathDescriptor collapses all of that into one frozen dataclass
that every discovery tool, every validator guard, and every recipe
grounder consumes. Fields default to None (meaning “unknown /
unavailable”), never to a sentinel like [] that a caller might
misread as “empty allowed set”.
The envelope is DELIBERATELY additive to the existing tools — the
per-probe responses still ship their historical shape so nothing on
the wire breaks, and PathDescriptor is composed on top from
those responses via PathDescriptor.from_batch().
Example#
from ansys.fluent.mcp.common.path_descriptor import PathDescriptor
desc = PathDescriptor(
path="setup.models.viscous.model",
kind="Parameter",
exists=True,
is_active=True,
allowed_values=(
"laminar",
"inviscid",
"k-epsilon",
"k-omega",
"les",
"des",
"reynolds-stress",
"transition-sst",
"spalart-allmaras",
),
)
assert desc.is_bounded_enum
assert "k-omega" in desc.allowed_values