Skip to main content
Glama

validate_ids

Validate IDS documents to ensure required fields, specification applicability, IFC version compatibility, and XSD schema compliance are met.

Instructions

Validate current session's IDS document.

Validates:

  1. Required fields present (title, specifications, etc.)

  2. Each specification has applicability

  3. IFC versions are valid

  4. XSD schema compliance (via IfcTester)

Args: ctx: FastMCP Context (auto-injected)

Returns: { "valid": true, "errors": [], "warnings": [], "specifications_count": 3, "details": { "has_title": true, "has_specifications": true, "xsd_valid": true } }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'validate_ids' tool. It validates the IDS document in the current session by checking for required fields (title, specifications), specification applicability, valid IFC versions, and XSD schema compliance using IfcTester. Returns validation results including errors, warnings, and details.
    async def validate_ids(ctx: Context) -> Dict[str, Any]:
        """
        Validate current session's IDS document.
    
        Validates:
        1. Required fields present (title, specifications, etc.)
        2. Each specification has applicability
        3. IFC versions are valid
        4. XSD schema compliance (via IfcTester)
    
        Args:
            ctx: FastMCP Context (auto-injected)
    
        Returns:
            {
                "valid": true,
                "errors": [],
                "warnings": [],
                "specifications_count": 3,
                "details": {
                    "has_title": true,
                    "has_specifications": true,
                    "xsd_valid": true
                }
            }
        """
        try:
            ids_obj = await get_or_create_session(ctx)
    
            await ctx.info("Validating IDS document")
    
            errors = []
            warnings = []
    
            # Check has title
            has_title = bool(ids_obj.info.get("title"))
            if not has_title:
                errors.append("IDS must have a title")
    
            # Check has specifications
            has_specifications = len(ids_obj.specifications) > 0
            if not has_specifications:
                errors.append("IDS must have at least one specification")
    
            # Valid IFC versions (from IDS 1.0 spec)
            valid_ifc_versions = {"IFC2X3", "IFC4", "IFC4X3", "IFC4X3_ADD2"}
    
            # Check each specification
            for i, spec in enumerate(ids_obj.specifications):
                spec_name = spec.name if spec.name else f"Specification {i}"
    
                # Check has name
                if not spec.name:
                    warnings.append(f"Specification at index {i} has no name")
    
                # Check has applicability facets
                if not spec.applicability or len(spec.applicability) == 0:
                    errors.append(
                        f"Specification '{spec_name}' (index {i}) has no applicability facets. "
                        "At least one applicability facet is required."
                    )
    
                # Check IFC versions are valid
                if hasattr(spec, 'ifcVersion'):
                    ifc_versions = spec.ifcVersion if isinstance(spec.ifcVersion, list) else [spec.ifcVersion]
                    for version in ifc_versions:
                        if version not in valid_ifc_versions:
                            warnings.append(
                                f"Specification '{spec_name}' uses non-standard IFC version: {version}"
                            )
    
            # Validate XSD compliance by attempting to serialize and re-parse
            xsd_valid = True
            try:
                xml_string = ids_obj.to_string()
                # Try to parse it back with XSD validation
                validated_ids = ids.from_string(xml_string, validate=True)
            except Exception as e:
                xsd_valid = False
                errors.append(f"XSD validation failed: {str(e)}")
    
            valid = len(errors) == 0
    
            await ctx.info(f"Validation complete: {'PASS' if valid else 'FAIL'}")
    
            return {
                "valid": valid,
                "errors": errors,
                "warnings": warnings,
                "specifications_count": len(ids_obj.specifications),
                "details": {
                    "has_title": has_title,
                    "has_specifications": has_specifications,
                    "xsd_valid": xsd_valid
                }
            }
    
        except Exception as e:
            await ctx.error(f"Validation error: {str(e)}")
            raise ToolError(f"Validation error: {str(e)}")
  • Registers the validate_ids tool (along with validate_ifc_model) on the FastMCP server instance.
    # Register validation tools
    mcp_server.tool(validation.validate_ids)
    mcp_server.tool(validation.validate_ifc_model)
  • Imports the validation module containing the validate_ids function, required for tool registration.
    from ids_mcp_server.tools import document, specification, facets, validation, restrictions
  • Docstring defining the tool's purpose, parameters (ctx only), and detailed return schema/structure.
    """
    Validate current session's IDS document.
    
    Validates:
    1. Required fields present (title, specifications, etc.)
    2. Each specification has applicability
    3. IFC versions are valid
    4. XSD schema compliance (via IfcTester)
    
    Args:
        ctx: FastMCP Context (auto-injected)
    
    Returns:
        {
            "valid": true,
            "errors": [],
            "warnings": [],
            "specifications_count": 3,
            "details": {
                "has_title": true,
                "has_specifications": true,
                "xsd_valid": true
            }
        }
    """
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by detailing what gets validated (four specific checks) and the return structure. It doesn't mention performance characteristics, error handling, or prerequisites like needing a loaded IDS document first, but covers core behavior adequately for a validation tool.

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 efficiently structured with a clear purpose statement, bulleted validation criteria, and explicit return format. Every sentence adds value: the first states what's validated, the bullets detail criteria, and the return section explains output. No wasted words or redundancy.

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

Completeness5/5

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

Given the tool has 0 parameters, no annotations, but a detailed output schema in the description, the description is complete. It explains what validation entails, documents the return structure thoroughly, and provides enough context for an agent to understand when and how to use this tool effectively.

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 input schema has 0 parameters with 100% coverage, so the baseline is 4. The description appropriately notes that 'ctx: FastMCP Context' is auto-injected, adding useful context about parameter handling without needing to document non-existent user parameters.

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 specific action ('validate') and target resource ('current session's IDS document'), distinguishing it from sibling tools like 'validate_ifc_model' which validates a different resource. It provides concrete validation criteria (required fields, applicability, IFC versions, XSD compliance) that make the purpose unambiguous and distinct.

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

Usage Guidelines4/5

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

The description implies usage context by specifying it validates 'current session's IDS document', suggesting it should be used when an IDS document is loaded in the session. However, it doesn't explicitly state when not to use it or name alternatives like 'validate_ifc_model' for different validation scenarios, leaving some guidance gaps.

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/vinnividivicci/ifc-ids-mcp'

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