Skip to main content
Glama
SethGame

FlexSim MCP Server

by SethGame

flexsim_set_node_value

Modify FlexSim simulation parameters by updating values in tree nodes to adjust model behavior during digital twin analysis.

Instructions

Set value in FlexSim tree node.

Args:
    node_path: Path to node
    value: New value to set

Example:
    node_path="Model/Processor1/variables/processtime"
    value=5.0

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for flexsim_set_node_value. Takes NodeAccessInput with node_path and value, builds FlexScript setvalue command, executes it via controller, and verifies the new value.
    @mcp.tool()
    async def flexsim_set_node_value(params: NodeAccessInput) -> str:
        """Set value in FlexSim tree node.
    
        Args:
            node_path: Path to node
            value: New value to set
    
        Example:
            node_path="Model/Processor1/variables/processtime"
            value=5.0
        """
        try:
            controller = await get_controller()
    
            if params.value is None:
                return "Error: No value provided"
    
            # Build script to set value
            if isinstance(params.value, str):
                script = f'setvalue(node("{params.node_path}"), "{params.value}")'
            else:
                script = f'setvalue(node("{params.node_path}"), {params.value})'
    
            controller.evaluate(script)
    
            # Verify
            verify = f'getvalue(node("{params.node_path}"))'
            new_value = controller.evaluate(verify)
    
            return f"✓ {params.node_path} = {new_value}"
        except Exception as e:
            return format_error(e)
  • Input schema definition for node access operations. Defines node_path (required string) and value (optional Any) fields using Pydantic BaseModel.
    class NodeAccessInput(BaseModel):
        """Input for node operations."""
        node_path: str = Field(..., min_length=1)
        value: Any | None = Field(default=None)
  • FastMCP server instance creation where tools are registered via the @mcp.tool() decorator.
    mcp = FastMCP("flexsim_mcp", lifespan=lifespan)
  • Error formatting utility used by the handler to format exceptions into user-friendly error messages with specific handling for common FlexSim 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}"
  • Controller getter function used by the handler to obtain the FlexSim controller instance, launching FlexSim if not already running.
    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?

With no annotations provided, the description carries full burden but offers minimal behavioral context. It states 'Set value' which implies a write/mutation operation, but doesn't disclose permissions needed, whether changes are immediate/persistent, error conditions, or side effects. The example adds some context but lacks comprehensive behavioral transparency.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args section and Example are well-structured and add necessary clarification without redundancy. Every sentence earns its place, though the formatting could be slightly more polished.

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 mutation nature, no annotations, and an output schema (which reduces need to describe returns), the description is moderately complete. It covers basic purpose and parameters but lacks important context about when/why to use it, behavioral implications, and integration with sibling tools. For a write operation, this leaves significant gaps.

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 description adds meaningful parameter context beyond the schema. With 0% schema description coverage and only 1 parameter (params object containing node_path and optional value), the description clarifies that node_path is a 'Path to node' and value is 'New value to set', plus provides a concrete example showing path structure and numeric value. This compensates well for the schema's lack of descriptions.

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 verb 'Set' and the resource 'value in FlexSim tree node', making the purpose immediately understandable. It distinguishes from siblings like flexsim_get_node_value (get vs set) but doesn't explicitly contrast with other write operations like flexsim_new_model or flexsim_save_model.

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., needing an open model), exclusions, or relationships to sibling tools like flexsim_get_node_value for reading values or flexsim_save_model for persisting changes.

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