Skip to main content
Glama
SethGame

FlexSim MCP Server

by SethGame

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
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • 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)
  • 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)
  • 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()

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