Skip to main content
Glama
SethGame

FlexSim MCP Server

by SethGame

flexsim_reset

Reset a FlexSim simulation to its initial state with time set to zero, allowing you to restart model analysis from the beginning.

Instructions

Reset simulation to initial state (time = 0).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler implementation of flexsim_reset tool. Uses @mcp.tool() decorator for registration, gets the FlexSim controller, calls reset() to reset simulation to time 0, and returns a success message with error handling.
    @mcp.tool()
    async def flexsim_reset() -> str:
        """Reset simulation to initial state (time = 0)."""
        try:
            controller = await get_controller()
            controller.reset()
            return "✓ Simulation reset to time 0"
        except Exception as e:
            return format_error(e)
  • Helper function get_controller() that manages the global FlexSim controller instance with lazy initialization and thread-safe locking.
    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_error() that converts exceptions into user-friendly error messages for display.
    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}"
  • Test code that validates flexsim_reset tool is registered and tests its execution as part of the integration test suite.
    required_tools = ["flexsim_open_model", "flexsim_reset", "flexsim_run",
                     "flexsim_stop", "flexsim_get_time"]
    for tool in required_tools:
        if tool not in tool_names:
            print(f"\nERROR: {tool} tool not found!")
            return False
    
    print("\n✓ All required tools found")
    
    # Open model
    print(f"\nOpening model: {test_model}")
    result = await client.call_tool(
        "flexsim_open_model",
        {"model_path": str(test_model)}
    )
    
    if "result" not in result:
        print(f"\n✗ Failed to open model: {result.get('error')}")
        return False
    
    print("✓ Model opened")
    
    # Reset simulation
    print("\nResetting simulation...")
    result = await client.call_tool("flexsim_reset")
    if "result" not in result:
        print(f"\n✗ Failed to reset: {result.get('error')}")
        return False
    
    print("✓ Simulation reset")
  • FastMCP server initialization at module level where all @mcp.tool() decorated functions including flexsim_reset are registered with the MCP server.
    mcp = FastMCP("flexsim_mcp", lifespan=lifespan)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Reset simulation') but lacks details on side effects (e.g., does it clear all data, require specific permissions, or have rate limits), the response format, or error conditions. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

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 extremely concise and front-loaded, consisting of a single sentence that directly states the tool's action and outcome. There is no wasted language or redundancy, making it efficient and easy to parse, which is ideal for a simple tool with no parameters.

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 has an output schema), the description is minimally adequate. It explains what the tool does but lacks details on behavioral aspects like side effects or usage context. The presence of an output schema means return values are documented elsewhere, but the description could benefit from more completeness for safe and effective use.

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 schema description coverage is 100%, so no parameter documentation is needed. The description does not add parameter details, which is appropriate here, as there are no parameters to explain. This meets the baseline for tools with no parameters, but does not exceed it by providing extra context.

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 action ('Reset simulation') and the outcome ('to initial state (time = 0)'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'flexsim_new_model' or 'flexsim_stop', which might also involve resetting or initializing states, leaving room for ambiguity in sibling context.

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, such as whether it should be used after a simulation run or in conjunction with other tools like 'flexsim_stop'. There is no mention of prerequisites, exclusions, or recommended contexts, relying solely on the implied action without operational context.

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