add_material_facet
Add material requirements to building specifications by defining material names, categories, or URIs as required, optional, or prohibited for specific sections.
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
| Name | Required | Description | Default |
|---|---|---|---|
| spec_id | Yes | ||
| location | Yes | ||
| material_value | Yes | ||
| cardinality | No | required |
Implementation Reference
- The main handler function that implements the add_material_facet tool. It adds a material facet to the applicability or requirements section 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)}")
- src/ids_mcp_server/server.py:37-37 (registration)Registers the add_material_facet handler as an MCP tool in the FastMCP server instance.mcp_server.tool(facets.add_material_facet)