flexsim_save_model
Save the current FlexSim simulation model to a specified file path, preserving all configurations and data for future use or analysis.
Instructions
Save the current model.
Args:
save_path: Path to save (optional, uses current if not provided)
Example:
save_path="C:/Models/warehouse_v2.fsm"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- mcp_server/flexsim_mcp.py:438-461 (handler)The main handler function flexsim_save_model that executes the save model logic. It accepts an optional save_path parameter, uses the FlexSim controller to evaluate the savemodel() FlexScript command, and returns a success message indicating where the model was saved.@mcp.tool() async def flexsim_save_model(params: SaveModelInput) -> str: """Save the current model. Args: save_path: Path to save (optional, uses current if not provided) Example: save_path="C:/Models/warehouse_v2.fsm" """ try: controller = await get_controller() if params.save_path: script = f'savemodel("{params.save_path}")' location = params.save_path else: script = "savemodel()" location = "current location" controller.evaluate(script) return f"✓ Model saved to {location}" except Exception as e: return format_error(e)
- mcp_server/flexsim_mcp.py:99-101 (schema)The SaveModelInput schema class that defines the input validation for the flexsim_save_model tool. It uses Pydantic BaseModel with an optional save_path string field that defaults to None.class SaveModelInput(BaseModel): """Input for saving model.""" save_path: str | None = Field(default=None)
- mcp_server/flexsim_mcp.py:438-438 (registration)The @mcp.tool() decorator that registers the flexsim_save_model function as an MCP tool, making it available to clients through the Model Context Protocol server.@mcp.tool()