Skip to main content
Glama

add_attribute_facet

Add attribute facets to IDS specifications to define required, optional, or prohibited attributes with specific values for applicability or requirements sections.

Instructions

Add an attribute facet to a specification.

Args: spec_id: Specification identifier location: "applicability" or "requirements" attribute_name: Attribute name (e.g., "Name", "Description") ctx: FastMCP Context (auto-injected) value: Required value or pattern cardinality: "required", "optional", or "prohibited"

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spec_idYes
locationYes
attribute_nameYes
valueNo
cardinalityNorequired

Implementation Reference

  • The core handler function that executes the tool logic: retrieves the IDS session and specification, creates an Attribute facet using the ifctester.ids library, appends it to the appropriate section (applicability or requirements), and returns a success status.
    async def add_attribute_facet( spec_id: str, location: str, attribute_name: str, ctx: Context, value: Optional[str] = None, cardinality: str = "required" ) -> Dict[str, Any]: """ Add an attribute facet to a specification. Args: spec_id: Specification identifier location: "applicability" or "requirements" attribute_name: Attribute name (e.g., "Name", "Description") ctx: FastMCP Context (auto-injected) value: Required value or pattern cardinality: "required", "optional", or "prohibited" Returns: {"status": "added", "facet_type": "attribute", "spec_id": "S1"} """ try: ids_obj = await get_or_create_session(ctx) spec = _find_specification(ids_obj, spec_id) await ctx.info(f"Adding attribute facet: {attribute_name} to {spec_id}") # Create attribute facet using IfcTester attr = ids.Attribute( name=attribute_name, value=value, cardinality=cardinality if location == "requirements" else None ) # Add to appropriate section if location == "applicability": spec.applicability.append(attr) elif location == "requirements": spec.requirements.append(attr) else: raise ToolError(f"Invalid location: {location}") await ctx.info(f"Attribute facet added: {attribute_name}") return { "status": "added", "facet_type": "attribute", "spec_id": spec_id } except ToolError: raise except Exception as e: await ctx.error(f"Failed to add attribute facet: {str(e)}") raise ToolError(f"Failed to add attribute facet: {str(e)}")
  • Registers the add_attribute_facet handler as a tool with the FastMCP server instance.
    mcp_server.tool(facets.add_attribute_facet)

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