The base.py module#
Summary#
Base server class for a single Fluids MCP leaf. |
|
Raised when a backend call fails because the backend is unavailable. |
|
Raised when a backend call fails because the backend is not connected. |
Glob-expand |
Description#
Base MCP server for a Fluids leaf (geometry/mesh/solve/post).
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 organisation level.
- Auto-registers the standard deterministic tool surface:
session_status,connect,disconnect,list_named_objects,get_state,get_targeted_context,run_code,validate_code,screenshot, and others (see ALL_TOOLS).
Concrete leaves only have to declare which tools to expose (subset of the above) so we keep 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]#
Glob-expand
patternovernamed[collection].Pure-data helper — no backend, no I/O. Used by both the
select_named_objectsMCP tool and tests. Accepts either dotted (setup.boundary_conditions.wall) or slashed-and-hyphenated (setup/boundary-conditions/wall) collection spellings so callers don’t have to know which naming convention the active backend happens to use.- Parameters:
- named
dict[str,list[str]] Mapping of available named objects.
- collection
str Collection of named objects to search.
- pattern
str Selection pattern used to match object names.
- include_shadowsbool
Whether shadow objects should be included in results.
- exclude
Optional[list[str]] Names or patterns excluded from the selection.
- named
- Returns:
- base.ALL_TOOLS = ('session_status', 'connect', 'disconnect', 'list_named_objects', 'find_named_object',...#