FluidsLeafMCP#

class ansys.cfx.mcp.common.base.FluidsLeafMCP(*, backends: dict[str, ansys.cfx.mcp.common.backend.Backend], expose_tools: Iterable[str] = ALL_TOOLS, hide_connection_tools: bool = False, conversation_store: ansys.cfx.mcp.common.conversation.ConversationStore | None = None, codegen_pipeline: ansys.cfx.mcp.common.codegen.CodegenPipeline | None = None, name: str | None = None, **fastmcp_kwargs: Any)#

Bases: ansys.common.mcp.server.PyAnsysBaseMCP

Base server class for a single shared MCP leaf.

Overview#

run

Run the MCP server event loop for the configured transport.

product_startup

Run product-specific startup hooks before serving MCP requests.

product_cleanup

Run product-specific cleanup hooks before shutdown.

build_toolsets

Build toolset metadata for the tools exposed by this leaf server.

register_run_code_observer

Register a callback that observes successful run-code executions.

backend

Return the currently active backend instance.

Import detail#

from ansys.cfx.mcp.common.base import FluidsLeafMCP

Property detail#

property FluidsLeafMCP.backend: ansys.cfx.mcp.common.backend.Backend#

Return the currently active backend instance.

Returns:
Backend

Value computed by the helper for the requested CFX workflow.

Attribute detail#

FluidsLeafMCP.leaf_name: str = 'fluids'#
FluidsLeafMCP.default_backend_kind: str | None = None#
FluidsLeafMCP.cache_ttl_seconds: float = 30.0#
FluidsLeafMCP.connect_on_startup: bool = False#
FluidsLeafMCP.component_label: str = ''#
FluidsLeafMCP.error_remediation_description: str = 'Generate a Markdown remediation / how-to answer for a natural-language request (error message,...#

Method detail#

FluidsLeafMCP.run(transport: str = 'stdio', host: str | None = None, port: int | None = None) None#

Run the MCP server event loop for the configured transport.

Parameters:
transportstr, optional

LLM transport implementation to use. Default is 'stdio'.

hoststr | None, optional

Host interface for the MCP transport. Default is None.

portint | None, optional

Port of the running CFX service to attach to. Default is None.

Returns:
None

No value is returned; side effects are applied to the relevant cache, session, or server.

FluidsLeafMCP.product_startup() None#

Run product-specific startup hooks before serving MCP requests.

Returns:
None

No value is returned; side effects are applied to the relevant cache, session, or server.

FluidsLeafMCP.product_cleanup() None#

Run product-specific cleanup hooks before shutdown.

Returns:
None

No value is returned; side effects are applied to the relevant cache, session, or server.

FluidsLeafMCP.build_toolsets() list[dict[str, Any]]#

Build toolset metadata for the tools exposed by this leaf server.

Returns:
list[dict[str, Any]]

List of structured records matching the request.

FluidsLeafMCP.register_run_code_observer(observer: Callable[Ellipsis, Awaitable[None] | None]) None#

Register a callback that observes successful run-code executions.

Parameters:
observerCallable[…, Awaitable[None] | None]

Callback to notify after run-code execution.

Returns:
None

No value is returned; the callback is stored for later notifications.