Skip to main content
Glama

validate_model

Check your Stella model for errors and warnings to ensure it is valid and ready for export or simulation.

Instructions

Validate the current model for errors and warnings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'validate_model' tool. Calls validate_model() and formats the results as TextContent with error/warning prefixes.
    elif name == "validate_model":
        model = get_model()
        errors = validate_model(model)
        if not errors:
            return [TextContent(type="text", text="Model validation passed with no errors or warnings.")]
    
        result_lines = ["Model validation results:"]
        for err in errors:
            prefix = "ERROR" if err.severity == "error" else "WARNING"
            result_lines.append(f"  [{prefix}] {err.category}: {err.message}")
        return [TextContent(type="text", text="\n".join(result_lines))]
  • Registration of the 'validate_model' tool with its inputSchema (empty object, no parameters required).
    Tool(
        name="validate_model",
        description="Validate the current model for errors and warnings",
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
  • Tool registration in the list_tools() function under @server.list_tools() decorator.
    Tool(
        name="validate_model",
        description="Validate the current model for errors and warnings",
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
  • Convenience function validate_model() that creates a ModelValidator instance and runs validation.
    def validate_model(model: StellaModel) -> list[ValidationError]:
        """Convenience function to validate a model."""
        validator = ModelValidator(model)
        return validator.validate()
  • ModelValidator class with all validation logic: undefined variables, mass balance, missing connections, orphan flows, stock-flow consistency, and circular dependencies.
    class ModelValidator:
        """Validates Stella models for common errors."""
    
        def __init__(self, model: StellaModel):
            self.model = model
            self.errors: list[ValidationError] = []
    
        def validate(self) -> list[ValidationError]:
            """Run all validation checks and return errors/warnings."""
            self.errors = []
    
            self._check_undefined_variables()
            self._check_mass_balance()
            self._check_missing_connections()
            self._check_orphan_flows()
            self._check_stock_inflow_outflow_consistency()
            self._check_circular_dependencies()
    
            return self.errors
Behavior2/5

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

No annotations are provided, and the description only states it 'validates for errors and warnings'. It does not disclose whether the tool modifies state, what side effects exist, or what format the results are returned in. The behavioral disclosure is minimal.

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, concise sentence with no unnecessary words. It is well front-loaded and easy to parse.

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

Completeness4/5

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

Given the tool has no parameters and a simple purpose, the description is mostly complete. However, it lacks information about the output or return format, which could be helpful for an agent to understand the result.

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?

There are no parameters, so the baseline is 4. The description does not need to add parameter info, and it correctly avoids adding irrelevant detail.

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

Purpose5/5

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

The description clearly states the tool's action ('Validate') and target ('the current model for errors and warnings'). It distinguishes well from siblings like add_aux, create_model, read_model, etc., which are about different operations.

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 does not mention prerequisites, timing relative to other operations, or when to avoid it.

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/bradleylab/stella-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server