Skip to main content
Glama
SethGame

FlexSim MCP Server

by SethGame

flexsim_get_time

Retrieve the current simulation time in FlexSim to monitor model progression, synchronize operations, and track performance metrics during manufacturing or warehouse digital twin analysis.

Instructions

Get current simulation time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main implementation of flexsim_get_time tool. Decorated with @mcp.tool() which registers it as an MCP tool. Retrieves current simulation time from FlexSim controller and returns formatted string with both human-readable and raw time values.
    @mcp.tool()
    async def flexsim_get_time() -> str:
        """Get current simulation time."""
        try:
            controller = await get_controller()
            time = controller.time()
            return f"Time: {format_time(time)} ({time:.2f}s)"
        except Exception as e:
            return format_error(e)
  • Helper function get_controller() used by flexsim_get_time to obtain or create the FlexSim controller instance with thread-safe access.
    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_time() used by flexsim_get_time to convert simulation seconds into human-readable format (e.g., '1.23s', '5.00m', '2.50h').
    def format_time(seconds: float) -> str:
        """Format simulation time as human-readable string."""
        if seconds < 60:
            return f"{seconds:.2f}s"
        elif seconds < 3600:
            return f"{seconds/60:.2f}m"
        else:
            return f"{seconds/3600:.2f}h"
  • Helper function format_error() used by flexsim_get_time to convert exceptions into user-friendly error messages with categorization for common error types.
    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}"
  • app.py:122-131 (registration)
    Documentation table in app.py listing flexsim_get_time among the exposed simulation control tools with its description.
    ### Simulation Control
    | Tool | Description |
    |------|-------------|
    | `flexsim_open_model` | Open .fsm or .fsx model file |
    | `flexsim_reset` | Reset simulation to time 0 |
    | `flexsim_run` | Start continuous simulation |
    | `flexsim_run_to_time` | Run until target time (fast or real-time) |
    | `flexsim_stop` | Pause running simulation |
    | `flexsim_step` | Advance by N events |
    | `flexsim_get_time` | Query current simulation time |
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 what the tool does but doesn't describe how it behaves—e.g., whether it returns a timestamp format, if it requires an active simulation, error conditions, or performance implications. For a tool with zero annotation coverage, this is a significant gap in transparency.

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, clear sentence with zero waste—'Get current simulation time' is front-loaded and perfectly concise. Every word earns its place, making it easy for an agent to parse quickly without fluff.

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 the tool's simplicity (0 parameters, no annotations, but with an output schema), the description is minimally adequate. It states the purpose but lacks context on usage, behavior, or output format. The output schema existence means the description doesn't need to explain return values, but it should still cover more behavioral aspects for a tool in a simulation environment.

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 schema description coverage is 100%, so there's no need for parameter documentation in the description. The baseline for 0 parameters is 4, as the description appropriately avoids unnecessary parameter details. It doesn't add or detract from parameter understanding.

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 'Get current simulation time' clearly states the verb ('Get') and resource ('current simulation time'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'flexsim_get_statistics' or 'flexsim_get_node_value' beyond the obvious time focus, so it doesn't reach the highest tier of sibling differentiation.

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 prerequisites (e.g., requires a running simulation), exclusions, or comparisons to similar tools like 'flexsim_step' or 'flexsim_run_to_time' for time-related operations. The agent must infer usage from the name alone.

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