Skip to main content
Glama

export_ids

Export IDS documents to XML files with automatic validation against the IDS 1.0 standard using IfcTester. Converts buildingSMART specifications into compliant XML format.

Instructions

Export IDS document to XML file using IfcTester.

Uses current session automatically - no session_id parameter needed!

Args: ctx: FastMCP Context (auto-injected) output_path: File path (optional, returns XML string if not provided) validate: Whether to validate against XSD (default: True)

Returns: { "status": "exported", "xml": "...", # If no output_path "file_path": "...", # If output_path provided "validation": {"valid": true, "errors": []} }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
output_pathNo
validateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function implementing the export_ids tool logic. Exports the current session's IDS document to an XML file or string, with optional XSD validation using IfcTester's ids module.
    async def export_ids(
        ctx: Context,
        output_path: Optional[str] = None,
        validate: bool = True
    ) -> Dict[str, Any]:
        """
        Export IDS document to XML file using IfcTester.
    
        Uses current session automatically - no session_id parameter needed!
    
        Args:
            ctx: FastMCP Context (auto-injected)
            output_path: File path (optional, returns XML string if not provided)
            validate: Whether to validate against XSD (default: True)
    
        Returns:
            {
                "status": "exported",
                "xml": "...",  # If no output_path
                "file_path": "...",  # If output_path provided
                "validation": {"valid": true, "errors": []}
            }
        """
        try:
            # Get IDS from session
            ids_obj = await get_or_create_session(ctx)
    
            validation_result = {"valid": True, "errors": []}
    
            # Export based on whether path is provided
            if output_path:
                await ctx.info(f"Exporting IDS to file: {output_path}")
                # Create parent directory if needed
                Path(output_path).parent.mkdir(parents=True, exist_ok=True)
                ids_obj.to_xml(output_path)
    
                # Validate if requested
                if validate:
                    try:
                        validated_ids = ids.open(output_path, validate=True)
                        validation_result["valid"] = True
                    except Exception as e:
                        validation_result["valid"] = False
                        validation_result["errors"] = [str(e)]
    
                await ctx.info(f"IDS exported successfully to {output_path}")
    
                return {
                    "status": "exported",
                    "file_path": output_path,
                    "validation": validation_result
                }
            else:
                await ctx.info("Exporting IDS to XML string")
                xml_string = ids_obj.to_string()
    
                # Validate if requested
                if validate:
                    try:
                        validated_ids = ids.from_string(xml_string, validate=True)
                        validation_result["valid"] = True
                    except Exception as e:
                        validation_result["valid"] = False
                        validation_result["errors"] = [str(e)]
    
                await ctx.info("IDS exported successfully to XML string")
    
                return {
                    "status": "exported",
                    "xml": xml_string,
                    "validation": validation_result
                }
    
        except Exception as e:
            await ctx.error(f"Failed to export IDS: {str(e)}")
            raise ToolError(f"Failed to export IDS: {str(e)}")
  • Registers the export_ids tool from the document module with the FastMCP server instance.
    mcp_server.tool(document.export_ids)
  • Imports the document module containing the export_ids tool for registration.
    from ids_mcp_server.tools import document, specification, facets, validation, restrictions
  • Docstring providing input/output schema description and type hints for FastMCP tool inference.
    """
    Export IDS document to XML file using IfcTester.
    
    Uses current session automatically - no session_id parameter needed!
    
    Args:
        ctx: FastMCP Context (auto-injected)
        output_path: File path (optional, returns XML string if not provided)
        validate: Whether to validate against XSD (default: True)
    
    Returns:
        {
            "status": "exported",
            "xml": "...",  # If no output_path
            "file_path": "...",  # If output_path provided
            "validation": {"valid": true, "errors": []}
        }
    """
Behavior4/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 effectively describes key behaviors: the tool automatically uses the current session (no session_id needed), can output to a file or return XML string, and includes validation capabilities. It also clearly explains the conditional return structure based on whether output_path is provided. The only minor gap is lack of information about error handling or performance characteristics.

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 perfectly structured and concise. It begins with the core purpose, then provides important usage note, followed by clear parameter documentation, and finally the return structure. Every sentence earns its place with no wasted words, and information is front-loaded appropriately.

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's moderate complexity (2 parameters, validation functionality), no annotations, and the presence of an output schema, the description is complete. It explains the tool's purpose, usage context, parameter behaviors, and the output schema handles return values. The description provides everything needed beyond the structured fields.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must fully compensate. It provides excellent parameter semantics: explains that 'ctx' is auto-injected (not a user parameter), describes 'output_path' as optional with clear behavior when omitted (returns XML string), and explains 'validate' with its default and purpose (validate against XSD). This adds substantial value beyond the bare schema.

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 purpose: 'Export IDS document to XML file using IfcTester.' It specifies the verb (export), resource (IDS document), format (XML file), and technology (IfcTester). This distinguishes it from sibling tools like 'validate_ids' or 'create_ids' which have different functions.

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 provides clear context for usage: 'Uses current session automatically - no session_id parameter needed!' This indicates when to use this tool (with an active session) versus alternatives that might require session management. However, it doesn't explicitly state when NOT to use it or name specific alternative tools for different scenarios.

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