Skip to main content
Glama

add_partof_facet

Add part-of relationships to buildingSMART IDS specifications, defining how entities relate to parent components with configurable cardinality and location settings.

Instructions

Add a partOf facet to a specification.

Args: spec_id: Specification identifier location: "applicability" or "requirements" relation: Relationship type (e.g., "IFCRELCONTAINEDINSPATIALSTRUCTURE") parent_entity: Parent entity name (e.g., "IFCSPACE") ctx: FastMCP Context (auto-injected) parent_predefined_type: Optional predefined type for parent cardinality: "required", "optional", or "prohibited"

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spec_idYes
locationYes
relationYes
parent_entityYes
parent_predefined_typeNo
cardinalityNorequired

Implementation Reference

  • The main asynchronous handler function implementing the logic for the 'add_partof_facet' tool. It adds a PartOf facet to the specified section (applicability or requirements) of an IDS specification using the IfcTester library.
    async def add_partof_facet( spec_id: str, location: str, relation: str, parent_entity: str, ctx: Context, parent_predefined_type: Optional[str] = None, cardinality: str = "required" ) -> Dict[str, Any]: """ Add a partOf facet to a specification. Args: spec_id: Specification identifier location: "applicability" or "requirements" relation: Relationship type (e.g., "IFCRELCONTAINEDINSPATIALSTRUCTURE") parent_entity: Parent entity name (e.g., "IFCSPACE") ctx: FastMCP Context (auto-injected) parent_predefined_type: Optional predefined type for parent cardinality: "required", "optional", or "prohibited" Returns: {"status": "added", "facet_type": "partof", "spec_id": "S1"} """ try: ids_obj = await get_or_create_session(ctx) spec = _find_specification(ids_obj, spec_id) await ctx.info(f"Adding partOf facet: {relation} to {spec_id}") # Create partOf facet using IfcTester # PartOf takes name directly, not an entity object part_of = ids.PartOf( name=parent_entity.upper(), predefinedType=parent_predefined_type, relation=relation.upper(), cardinality=cardinality if location == "requirements" else None ) # Add to appropriate section if location == "applicability": spec.applicability.append(part_of) elif location == "requirements": spec.requirements.append(part_of) else: raise ToolError(f"Invalid location: {location}") await ctx.info(f"PartOf facet added: {relation}") return { "status": "added", "facet_type": "partof", "spec_id": spec_id } except ToolError: raise except Exception as e: await ctx.error(f"Failed to add partOf facet: {str(e)}") raise ToolError(f"Failed to add partOf facet: {str(e)}")
  • Registration of the 'add_partof_facet' tool (line 38) within the FastMCP server instance, alongside other facet management tools.
    # Register facet management tools mcp_server.tool(facets.add_entity_facet) mcp_server.tool(facets.add_property_facet) mcp_server.tool(facets.add_attribute_facet) mcp_server.tool(facets.add_classification_facet) mcp_server.tool(facets.add_material_facet) mcp_server.tool(facets.add_partof_facet)
  • Import statement that brings in the 'facets' module containing the 'add_partof_facet' handler.
    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