Skip to main content
Glama
SethGame

FlexSim MCP Server

by SethGame

flexsim_reset

Reset a FlexSim simulation to its initial state with time set to zero, allowing you to restart model analysis from the beginning.

Instructions

Reset simulation to initial state (time = 0).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Main handler implementation of flexsim_reset tool. Uses @mcp.tool() decorator for registration, gets the FlexSim controller, calls reset() to reset simulation to time 0, and returns a success message with error handling.
    @mcp.tool() async def flexsim_reset() -> str: """Reset simulation to initial state (time = 0).""" try: controller = await get_controller() controller.reset() return "✓ Simulation reset to time 0" except Exception as e: return format_error(e)
  • Helper function get_controller() that manages the global FlexSim controller instance with lazy initialization and thread-safe locking.
    async def get_controller(): """Get or create the FlexSim controller instance.""" global _controller async with _controller_lock: if _controller is None: _controller = await launch_flexsim() return _controller
  • Helper function format_error() that converts exceptions into user-friendly error messages for display.
    def format_error(e: Exception) -> str: """Format exception as user-friendly error message.""" msg = str(e) if "not found" in msg.lower(): return f"Not found: {msg}" elif "syntax" in msg.lower(): return f"FlexScript syntax error: {msg}" elif "license" in msg.lower(): return f"License error: {msg}" elif "permission" in msg.lower(): return f"Permission denied: {msg}" return f"Error: {msg}"
  • Test code that validates flexsim_reset tool is registered and tests its execution as part of the integration test suite.
    required_tools = ["flexsim_open_model", "flexsim_reset", "flexsim_run", "flexsim_stop", "flexsim_get_time"] for tool in required_tools: if tool not in tool_names: print(f"\nERROR: {tool} tool not found!") return False print("\n✓ All required tools found") # Open model print(f"\nOpening model: {test_model}") result = await client.call_tool( "flexsim_open_model", {"model_path": str(test_model)} ) if "result" not in result: print(f"\n✗ Failed to open model: {result.get('error')}") return False print("✓ Model opened") # Reset simulation print("\nResetting simulation...") result = await client.call_tool("flexsim_reset") if "result" not in result: print(f"\n✗ Failed to reset: {result.get('error')}") return False print("✓ Simulation reset")
  • FastMCP server initialization at module level where all @mcp.tool() decorated functions including flexsim_reset are registered with the MCP server.
    mcp = FastMCP("flexsim_mcp", lifespan=lifespan)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SethGame/mcp_flexsim'

If you have feedback or need assistance with the MCP directory API, please join our Discord server