The helpers.py module#

Summary#

connect_to_modeler_in_persistent_python

Connect to the Modeler instance in the persistent Python session.

refresh_design_in_persistent_python

Rebind design in the persistent Python session to the active design.

Description#

Helper functions for PyAnsys Geometry-MCP.

Module detail#

helpers.connect_to_modeler_in_persistent_python(ctx: fastmcp.server.Context) → Any#

Connect to the Modeler instance in the persistent Python session.

This tool connects to the Modeler instance from within the persistent Python session. It assumes that the persistent session has already been created.

Parameters#

ctxContext

MCP context containing server session and app context.

Returns#

str

Connection status message.

helpers.refresh_design_in_persistent_python(ctx: fastmcp.server.Context) → None#

Rebind design in the persistent Python session to the active design.

The persistent session runs in its own process with its own Modeler client, so the design it holds has to be re-read whenever the active design changes. This function does nothing when the session is not connected yet. The connection step refreshes the design itself.

Parameters#

ctxContext

MCP context containing server session and app context.