Skip to main content
Glama

export_ids

Export IDS documents to XML format with automatic validation against XSD schemas, supporting file output or direct XML string returns.

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

Implementation Reference

  • The primary handler function that implements the export_ids tool. It retrieves the IDS object from the session, exports it to a file or XML string, optionally validates it, and returns the result.
    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)}")
  • The line where the export_ids tool is registered with the FastMCP server instance.
    mcp_server.tool(document.export_ids)
  • The docstring in the handler function defines the input parameters and output schema for the tool.
    """ 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": []} } """

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