Skip to main content
Glama

export_ifc_data

Extract and export IFC building model data to JSON or CSV files, with filtering options for entity types and building levels.

Instructions

Export IFC data to a file in JSON or CSV format.

This tool extracts IFC data and creates a structured export file. You can filter
by entity type and/or building level, and choose the output format.

Args:
    entity_type: Type of IFC entity to export (e.g., "IfcWall") - leave empty for all entities
    level_name: Name of the building level to filter by (e.g., "Level 1") - leave empty for all levels
    output_format: "json" or "csv" format for the output file
    
Returns:
    Confirmation message with the export file path or an error message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_typeNo
level_nameNo
output_formatNocsv
ctxNo

Implementation Reference

  • The MCP tool handler for 'export_ifc_data'. This function proxies the request to the Blender addon via socket command, validates parameters, handles errors, and returns results as JSON.
    @mcp.tool()
    def export_ifc_data(
        entity_type: str | None = None, 
        level_name: str | None = None, 
        output_format: str = "csv",
        ctx: Context | None = None
    ) -> str:
        """
        Export IFC data to a file in JSON or CSV format.
        
        This tool extracts IFC data and creates a structured export file. You can filter
        by entity type and/or building level, and choose the output format.
        
        Args:
            entity_type: Type of IFC entity to export (e.g., "IfcWall") - leave empty for all entities
            level_name: Name of the building level to filter by (e.g., "Level 1") - leave empty for all levels
            output_format: "json" or "csv" format for the output file
            
        Returns:
            Confirmation message with the export file path or an error message
        """
        try:
            # Get Blender connection
            blender = get_blender_connection()
    
            # Validate output format
            if output_format not in ["json", "csv"]:
                return "Error: output_format must be 'json' or 'csv'"
    
            # Execute the export code in Blender
            result = blender.send_command("export_ifc_data", {
                "entity_type": entity_type,
                "level_name": level_name,
                "output_format": output_format
            })
            
            # Check for errors from Blender
            if isinstance(result, dict) and "error" in result:
                return f"Error: {result['error']}"
            
            # Return the result with export summary
            # return result
            return json.dumps(result, indent=2)
        
        except Exception as e:
            logger.error(f"Error exporting IFC data: {str(e)}")
            return f"Error exporting IFC data: {str(e)}"

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/JotaDeRodriguez/Bonsai_mcp'

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