The base.py module#

Summary#

FluidsLeafMCP

Base server class for a single shared MCP leaf.

select_named_objects_from_mapping

Filter named CFX objects from a mapping using include and exclude rules.

BackendUnavailable

NotConnected

Description#

Base MCP server for the CFX MCP leaf.

A leaf:

  • Picks one or more Backend instances at construction time.

  • Inherits from PyAnsysBaseMCP so it can be registered alongside other PyAnsys MCP servers at the organization level.

  • Auto-registers the requested tool surface from ALL_TOOLS, including

    session_status, connect, disconnect, codegen, clarify, model-context helpers, run_code, validate_code, and optional lifecycle/reporting tools.

Concrete leaves only have to declare which tools to expose as a subset of the preceding list, keeping the MCP surface lean per leaf.

Module detail#

base.select_named_objects_from_mapping(named: dict[str, list[str]], *, collection: str, pattern: str = '*', include_shadows: bool = True, exclude: list[str] | None = None) dict[str, Any]#

Filter named CFX objects from a mapping using include and exclude rules.

Parameters:
nameddict[str, list[str]]

Mapping of named objects grouped by collection.

collectionstr

Named-object collection to inspect.

patternstr, optional

Name or wildcard pattern used to select objects. Default is '*'.

include_shadowsbool, optional

Whether shadowed names should be included in object-selection results. Default is True.

excludeOptional[list[str]], optional

Names or patterns to omit from object-selection results. Default is None.

Returns:
dict[str, Any]

Structured response payload for the requested operation.

base.ALL_TOOLS = ('session_status', 'connect', 'disconnect', 'codegen', 'clarify', 'error_remediation',...#