flexsim_new_model
Create a new blank simulation model to build manufacturing or warehouse digital twins for analysis and parameter studies.
Instructions
Create a new blank model.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp_server/flexsim_mcp.py:464-472 (handler)Main handler implementation for flexsim_new_model tool. Gets the FlexSim controller, executes newmodel() FlexScript command, and returns success/error message.@mcp.tool() async def flexsim_new_model() -> str: """Create a new blank model.""" try: controller = await get_controller() controller.evaluate("newmodel()") return "✓ New blank model created" except Exception as e: return format_error(e)
- mcp_server/flexsim_mcp.py:147-154 (helper)Helper function get_controller() that retrieves or creates the FlexSim controller instance, used by flexsim_new_model to access the simulation.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
- mcp_server/flexsim_mcp.py:129-140 (helper)Helper function format_error() that formats exceptions into user-friendly error messages, used by flexsim_new_model for error handling.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}"
- mcp_server/flexsim_mcp.py:216-216 (registration)FastMCP server initialization at line 216 where the MCP server instance 'mcp' is created, which is used to register the flexsim_new_model tool via the @mcp.tool() decorator.mcp = FastMCP("flexsim_mcp", lifespan=lifespan)
- app.py:139-139 (schema)Documentation entry for flexsim_new_model tool in the Model & Script section, describing it as 'Create blank model'.| `flexsim_new_model` | Create blank model |