Skip to main content
Glama
SethGame

FlexSim MCP Server

by SethGame

flexsim_get_statistics

Retrieve simulation statistics and performance metrics from FlexSim models to analyze manufacturing and warehouse digital twin results.

Instructions

Get simulation statistics and performance metrics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main implementation of flexsim_get_statistics tool. It retrieves simulation performance metrics including current time, run speed, number of objects, and events processed by evaluating a FlexScript against the FlexSim controller.
    @mcp.tool()
    async def flexsim_get_statistics() -> str:
        """Get simulation statistics and performance metrics."""
        try:
            controller = await get_controller()
    
            stats_script = """
            {
                "time": getmodeltime(),
                "run_speed": get(runspeed()),
                "objects": Model.subnodes.length,
                "events": geteventsprocessed()
            }
            """
    
            result = controller.evaluate(stats_script)
            return f"Statistics:\n```json\n{result}\n```"
        except Exception as e:
            return format_error(e)
  • The tool is registered with the MCP server using the @mcp.tool() decorator, which automatically makes it available to MCP clients.
    @mcp.tool()
    async def flexsim_get_statistics() -> str:
  • Helper function format_error() used by flexsim_get_statistics to provide user-friendly error messages when exceptions occur.
    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}"
  • Helper function get_controller() used by flexsim_get_statistics to obtain or create the FlexSim controller instance with async locking for thread safety.
    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
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get[s] simulation statistics and performance metrics,' which implies a read-only operation, but it doesn't disclose any behavioral traits like whether it requires a simulation to be running, if it has rate limits, what the output format is, or if it affects simulation state. This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is front-loaded and appropriately sized for a tool with no parameters, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the tool has 0 parameters, 100% schema coverage, and an output schema exists, the description's job is simplified. However, it lacks context about when to use it, behavioral details, and how it differs from siblings, which are important for a tool in a simulation environment. The output schema may cover return values, but the description doesn't provide enough guidance for effective tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and the input schema has 100% description coverage, so there are no parameters to document. The description doesn't need to add parameter semantics, and it appropriately doesn't mention any. A baseline of 4 is applied since no parameters exist, and the description doesn't introduce confusion.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('simulation statistics and performance metrics'), making it easy to understand what it does. However, it doesn't distinguish this tool from potential siblings like 'flexsim_export_results' or 'flexsim_get_node_value', which might also retrieve data, so it falls short of a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context, or exclusions, such as whether it should be used after a simulation run or in place of other data-retrieval tools like 'flexsim_export_results'. This lack of usage context leaves the agent with minimal direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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