Skip to main content
Glama
ibm-ecm

IBM Core Content Services MCP Server

Official
by ibm-ecm

get_class_specific_properties_name

Retrieves custom property names for a document by identifying its class and filtering system properties, enabling targeted metadata extraction and search operations.

Instructions

Retrieves a list of class-specific property names for a document based on its class definition.

This tool first determines the document's class, then fetches the class metadata to identify all available properties specific to that document class. It filters out system properties and hidden properties.

Use this tool when you need to know what custom properties are available for a specific document, which can then be used for targeted property extraction or search operations.

:param identifier: The document id or path (required). This can be either the document's ID (GUID) or its path in the repository (e.g., "/Folder1/document.pdf").

:returns: A list of property display names that are available for the document's class. These properties can be used for further operations like property extraction or search.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYes

Implementation Reference

  • The handler function for the 'get_class_specific_properties_name' tool. It fetches the document's class name using GraphQL, retrieves class metadata using get_class_metadata_tool, filters out system/hidden/invalid properties, and returns a list of display names for valid properties.
    async def get_class_specific_properties_name(
        identifier: str,
    ) -> Union[dict, list, ToolError]:
        """
        Retrieves a list of class-specific property names for a document based on its class definition.
    
        This tool first determines the document's class, then fetches the class metadata to identify
        all available properties specific to that document class. It filters out system properties and
        hidden properties.
    
        Use this tool when you need to know what custom properties are available for a specific document,
        which can then be used for targeted property extraction or search operations.
    
        :param identifier: The document id or path (required). This can be either the document's ID (GUID)
                          or its path in the repository (e.g., "/Folder1/document.pdf").
    
        :returns: A list of property display names that are available for the document's class.
                 These properties can be used for further operations like property extraction or search.
        """
        # First, get the class name of the document
        query = """
        query getDocument($object_store_name: String!, $identifier: String!){
            document(repositoryIdentifier: $object_store_name, identifier: $identifier){
                className
            }
        }
        """
    
        var: dict[str, Any] = {
            "identifier": identifier,
            "object_store_name": graphql_client.object_store,
        }
    
        response = graphql_client.execute(query=query, variables=var)
    
        if "errors" in response:
            return response
    
        classname = response["data"]["document"]["className"]
    
        # Use get_class_metadata_tool to get the class properties
        class_metadata = get_class_metadata_tool(
            graphql_client=graphql_client,
            class_symbolic_name=classname,
            metadata_cache=metadata_cache,
        )
    
        if isinstance(class_metadata, ToolError):
            return class_metadata
    
        # Apply the same filtering logic as the original implementation
        property_list = []
        not_allowed_cardinality = [Cardinality.ENUM]
        not_allowed_data_type = [TypeID.OBJECT, TypeID.BINARY]
        not_include_property_name = EXCLUDED_PROPERTY_NAMES
    
        try:
            for prop in class_metadata.property_descriptions:
                if (
                    prop.data_type in not_allowed_data_type
                    or prop.cardinality in not_allowed_cardinality
                    or prop.symbolic_name in not_include_property_name
                    or prop.is_system_owned is True
                    or prop.is_hidden is True
                ):
                    continue
                property_list.append(prop.display_name)
        except Exception as e:
            return ToolError(
                message=f"Error processing property descriptions: {e}",
                suggestions=[
                    "Make sure the class exists",
                    "Check if the metadata cache is properly initialized",
                ],
            )
    
        return property_list
  • The @mcp.tool decorator that registers the 'get_class_specific_properties_name' handler function as an MCP tool.
    @mcp.tool(
        name="get_class_specific_properties_name",
    )

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/ibm-ecm/ibm-content-services-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server