Backend#
- class ansys.cfx.mcp.common.backend.Backend#
Bases:
abc.ABCCommon interface for all backends.
Concrete subclasses override only the methods their product supports. Default implementations raise a BackendUnavailable error.
Overview#
Connect this backend to a CFX runtime or service. |
|
Whether the backend is currently connected. |
Disconnect this backend from its active CFX runtime or service. |
|
Return a structured status summary for the active CFX backend or session manager. |
|
Generate CFX Python code or return a clarification request. |
|
Continue code generation after a clarification answer. |
|
Return recovery guidance for a failed backend operation. |
|
List named objects available in the active context. |
|
Return the subset of requested named objects that are available. |
|
Return help information for a backend-specific API path. |
|
Return solver status information for the backend. |
|
Return named object names for the active CFX context. |
|
Find named object matching the request. |
|
Get the state for the active CFX context. |
|
Get the active/inactive status for a CFX path or component. |
|
Get allowed values for a CFX path from live state or schema metadata. |
|
Get selected attributes for one or more backend nodes. |
|
Get selected attributes for children under a parent backend node. |
|
Check whether a backend path can be resolved. |
|
Get argument metadata for a command-like CFX path. |
|
Describe the fields used when creating a named CFX object. |
|
List fields available for a backend object or schema scope. |
|
Return a compact context slice for the requested CFX paths or objects. |
|
Return mesh adjacency information for candidate boundary locations. |
|
Find the API matching the request. |
|
Execute Python code against the active CFX backend namespace. |
|
Validate Python code without mutating the active backend. |
|
Return mesh entity counts reported by the backend. |
|
Return mesh quality metrics reported by the backend. |
|
Run backend mesh checks and return their diagnostics. |
|
Activate a backend component for later operations. |
|
Deactivate a backend component that should no longer receive operations. |
|
Update backend component state with new data. |
|
Refresh backend component state from the active session. |
|
Capture a screenshot from the active backend, when supported. |
|
Clear cached backend data that may no longer reflect the active CFX session. |
|
Clear live CFX session caches after the model or session state changes. |
Import detail#
from ansys.cfx.mcp.common.backend import Backend
Attribute detail#
Method detail#
- abstractmethod Backend.connect(**kwargs: Any) ansys.cfx.mcp.common.models.ConnectResult#
- Async:
Connect this backend to a CFX runtime or service.
- Parameters:
- kwargs
Any Keyword arguments forwarded to the wrapped callable.
- kwargs
- Returns:
ConnectResultConnection result describing the selected backend session.
- async Backend.disconnect() None#
Disconnect this backend from its active CFX runtime or service.
- Returns:
NoneNo value is returned. Side effects are applied to the relevant cache, session, or server.
- abstractmethod Backend.is_connected() bool#
Whether the backend is currently connected.
- Returns:
- bool
Whether the backend currently has an active CFX connection.
- Backend.status(leaf: str) ansys.cfx.mcp.common.models.SessionStatus#
Return a structured status summary for the active CFX backend or session manager.
- async Backend.codegen(prompt: str, *, session_id: str | None = None, context: dict[str, Any] | None = None) ansys.cfx.mcp.common.models.CodegenResult#
Generate CFX Python code or return a clarification request.
- Parameters:
- Returns:
CodegenResultGenerated-code response or clarification request.
- async Backend.clarify(session_id: str, clarification_id: str, answer: str) ansys.cfx.mcp.common.models.CodegenResult#
Continue code generation after a clarification answer.
- async Backend.error_remediation(remediation_request: str, *, context: dict[str, Any] | None = None) ansys.cfx.mcp.common.models.RemediationResult#
Return recovery guidance for a failed backend operation.
- async Backend.list_named_objects() dict[str, Any]#
List named objects available in the active context.
- async Backend.select_named_objects(names: list[str]) list[str]#
Return the subset of requested named objects that are available.
- async Backend.get_help(path: str) dict[str, Any]#
Return help information for a backend-specific API path.
- async Backend.get_named_object_names(collection_path: str) list[str]#
Return named object names for the active CFX context.
- async Backend.find_named_object(name: str) list[dict[str, Any]]#
Find named object matching the request.
- async Backend.get_state(paths: list[str] | None = None) dict[str, Any]#
Get the state for the active CFX context.
- async Backend.get_active_status(paths: list[str]) dict[str, bool]#
Get the active/inactive status for a CFX path or component.
- async Backend.get_allowed_values(paths: list[str]) dict[str, list[Any]]#
Get allowed values for a CFX path from live state or schema metadata.
- async Backend.get_node_attrs(paths: list[str], attrs: list[str]) dict[str, dict[str, Any]]#
Get selected attributes for one or more backend nodes.
- async Backend.get_node_attrs_bulk(parent_path: str, attrs: list[str]) dict[str, dict[str, Any]]#
Get selected attributes for children under a parent backend node.
- async Backend.probe_path(paths: list[str]) dict[str, dict[str, Any]]#
Check whether a backend path can be resolved.
- async Backend.get_command_arguments(path: str) dict[str, Any] | None#
Get argument metadata for a command-like CFX path.
- async Backend.describe_named_object_template(path: str) dict[str, Any] | None#
Describe the fields used when creating a named CFX object.
- async Backend.list_fields(*, scope: str = 'any') dict[str, Any] | None#
List fields available for a backend object or schema scope.
- async Backend.get_targeted_context(*, paths_to_check: list[str], named_object_types: list[str] | None = None, instance_state_fetch: list[str] | None = None) dict[str, Any]#
Return a compact context slice for the requested CFX paths or objects.
- Parameters:
- Returns:
- async Backend.mesh_adjacency_probe(cellzones: list[str], *, bc_filter: tuple[str, Ellipsis] | None = None) dict[str, list[str]]#
Return mesh adjacency information for candidate boundary locations.
- async Backend.find_api(query: str, *, top_k: int = 10, kinds: list[str] | None = None, under: str | None = None) list[dict[str, Any]]#
Find the API matching the request.
- Parameters:
- Returns:
-
async Backend.run_code(code: str, *, namespace: dict[str, Any] | None = None, filename: str = '
' ) ansys.cfx.mcp.common.models.RunCodeResult# Execute Python code against the active CFX backend namespace.
- Parameters:
- Returns:
RunCodeResultExecution or validation result returned to the MCP caller.
- async Backend.validate_code(code: str) ansys.cfx.mcp.common.models.RunCodeResult#
Validate Python code without mutating the active backend.
- Parameters:
- code
str Python source code submitted for validation, grounding, or execution.
- code
- Returns:
RunCodeResultExecution or validation result returned to the MCP caller.
- async Backend.mesh_counts() dict[str, int | None]#
Return mesh entity counts reported by the backend.
- async Backend.mesh_quality() dict[str, float | None]#
Return mesh quality metrics reported by the backend.
- async Backend.activate_component() dict[str, Any]#
Activate a backend component for later operations.
- async Backend.deactivate_component() dict[str, Any]#
Deactivate a backend component that should no longer receive operations.
- async Backend.refresh_component() dict[str, Any]#
Refresh backend component state from the active session.
- async Backend.screenshot(*, view: str | None = None) dict[str, Any]#
Capture a screenshot from the active backend, when supported.