Skip to main content
Glama

add_partof_facet

Adds a partOf facet to buildingSMART IDS specifications to define containment relationships between building elements, ensuring compliance with IDS 1.0 standards.

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 handler function that implements the core logic for adding a 'partOf' facet to an IDS specification. It retrieves the session and specification, creates a PartOf facet using the ifctester IDS library, appends it to the appropriate section (applicability or requirements), and returns success status.
    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)}")
  • Registers the 'add_partof_facet' handler as an MCP tool with the FastMCP server instance.
    mcp_server.tool(facets.add_partof_facet)
  • Imports the 'facets' module containing the 'add_partof_facet' implementation.
    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