Skip to main content
Glama

add_material_facet

Add material requirements to building specifications by defining material facets with location and cardinality for IDS compliance.

Instructions

Add a material facet to a specification.

Args: spec_id: Specification identifier location: "applicability" or "requirements" material_value: Material name, category, or URI ctx: FastMCP Context (auto-injected) cardinality: "required", "optional", or "prohibited"

Returns: {"status": "added", "facet_type": "material", "spec_id": "S1"}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spec_idYes
locationYes
material_valueYes
cardinalityNorequired

Implementation Reference

  • The asynchronous handler function implementing the core logic of the add_material_facet tool. It adds a material facet to the specified section (applicability or requirements) of an IDS specification using the IfcTester library.
    async def add_material_facet(
        spec_id: str,
        location: str,
        material_value: str,
        ctx: Context,
        cardinality: str = "required"
    ) -> Dict[str, Any]:
        """
        Add a material facet to a specification.
    
        Args:
            spec_id: Specification identifier
            location: "applicability" or "requirements"
            material_value: Material name, category, or URI
            ctx: FastMCP Context (auto-injected)
            cardinality: "required", "optional", or "prohibited"
    
        Returns:
            {"status": "added", "facet_type": "material", "spec_id": "S1"}
        """
        try:
            ids_obj = await get_or_create_session(ctx)
            spec = _find_specification(ids_obj, spec_id)
    
            await ctx.info(f"Adding material facet: {material_value} to {spec_id}")
    
            # Create material facet using IfcTester
            material = ids.Material(
                value=material_value,
                cardinality=cardinality if location == "requirements" else None
            )
    
            # Add to appropriate section
            if location == "applicability":
                spec.applicability.append(material)
            elif location == "requirements":
                spec.requirements.append(material)
            else:
                raise ToolError(f"Invalid location: {location}")
    
            await ctx.info(f"Material facet added: {material_value}")
    
            return {
                "status": "added",
                "facet_type": "material",
                "spec_id": spec_id
            }
    
        except ToolError:
            raise
        except Exception as e:
            await ctx.error(f"Failed to add material facet: {str(e)}")
            raise ToolError(f"Failed to add material facet: {str(e)}")
  • Registers the add_material_facet handler function as an MCP tool on the FastMCP server instance.
    mcp_server.tool(facets.add_material_facet)
  • Imports the facets module containing the add_material_facet function, enabling its use in tool registration.
    from ids_mcp_server.tools import document, specification, facets, validation, restrictions

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