Skip to main content
Glama
ibm-ecm

IBM Core Content Services MCP Server

Official
by ibm-ecm

repository_object_search

Find repository objects (excluding documents) by class and filter conditions. Retrieves matching object properties.

Instructions

PREREQUISITES IN ORDER: To use this tool, you MUST call two other tools first in a specific sequence.

  1. determine_class tool to get the class_name for search_class.

  2. get_searchable_property_descriptions to get a list of valid property_name for search_properties

Description: This tool retrieves repository objects other than Document instances.

:param search_parameters (SearchParameters): parameters for the searching including the object being searched for and any search conditions.

:returns: A the repository object details, including: - repositoryObjects (dict): a dictionary containing independentObjects: - independentObjects (list): A list of independent objects, each containing: - properties (list): A list of properties, each containing: - label (str): The name of the property. - value (str): The value of the property.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_parametersYesComplete set of parameters for executing a repository search.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The repository_object_search tool handler function. It delegates to get_repository_object_main() to execute the actual search logic.
    async def repository_object_search(
        search_parameters: SearchParameters,
    ) -> dict | ToolError:
        """
        **PREREQUISITES IN ORDER**: To use this tool, you MUST call two other tools first in a specific sequence.
        1. determine_class tool to get the class_name for search_class.
        2. get_searchable_property_descriptions to get a list of valid property_name for search_properties
    
        Description:
        This tool retrieves repository objects other than Document instances.
    
        :param search_parameters (SearchParameters): parameters for the searching including the object being searched for and any search conditions.
    
        :returns: A the repository object details, including:
            - repositoryObjects (dict): a dictionary containing independentObjects:
                - independentObjects (list): A list of independent objects, each containing:
                - properties (list): A list of properties, each containing:
                    - label (str): The name of the property.
                    - value (str): The value of the property.
        """
        return await get_repository_object_main(
            search_parameters, graphql_client, metadata_cache
        )
  • The get_repository_object_main() function that executes the repository object search. It processes search parameters, builds a GraphQL query, and calls graphql_client.execute_async() to retrieve matching repository objects.
    async def get_repository_object_main(
        search_parameters: SearchParameters,
        graphql_client: GraphQLClient,
        metadata_cache: MetadataCache,
        additional_filter_string: str = "",
    ) -> dict | ToolError:
        # Process search parameters using the utility function
        result = await process_search_parameters(
            graphql_client, metadata_cache, search_parameters
        )
    
        # Check if we got an error
        if isinstance(result, ToolError):
            return result
    
        # Unpack the result tuple
        search_properties_string, return_properties = result
        if additional_filter_string:
            search_properties_string = (
                f"{search_properties_string} and {additional_filter_string}"
                if search_properties_string
                else additional_filter_string
            )
    
        query = """
        query repositoryObjectsSearch($object_store_name: String!,
            $class_name: String!, $where_statement: String!, $return_props: [String!]){
            repositoryObjects(
            repositoryIdentifier: $object_store_name,
            from: $class_name,
            where: $where_statement
            ) {
            independentObjects {
                properties (includes: $return_props){
                id
                label
                value
                }
            }
            }
        }
        """
        var = {
            "object_store_name": graphql_client.object_store,
            "where_statement": search_properties_string,
            "class_name": search_parameters.search_class,
            "return_props": return_properties,
        }
    
        try:
            response = await graphql_client.execute_async(query=query, variables=var)
            return response  # Return response only if no exception occurs
        except Exception as e:
            return ToolError(
                message=f"Error executing search: {str(e)}",
                suggestions=[
                    "Check that all property names are valid for the class",
                    "Ensure property values match the expected data types",
                    "Verify that the operators are appropriate for the property data types",
                ],
            )
  • SearchParameters schema: Input model for the tool with search_class (str) and search_properties (List[SearchProperty]) fields.
    class SearchParameters(BaseModel):
        """
        Complete set of parameters for executing a repository search.
        """
    
        search_class: str = Field(
            ...,
            description="The class to search for. Must be a valid class in the repository.",
        )
        search_properties: List[SearchProperty] = Field(
            ...,
            description="List of filter conditions to apply to the search. All conditions are combined with AND logic. If no conditions exist, we return all objects of the given class",
        )
  • SearchProperty schema: Defines individual search conditions with property_name, property_value, and operator fields.
    class SearchProperty(BaseModel):
        """
        Defines a single search condition/filter to be applied during repository searches.
        """
    
        property_name: str = Field(
            ...,
            description="The name of the property to filter on. Must be a valid property for the specified class as obtained from the get_searchable_class_properties_tool .",
        )
        property_value: str = Field(
            ...,
            description="The value to filter by. Format should match the property's data type.",
        )
        operator: SearchOperator = Field(
            ...,
            description="The comparison operator that defines how property_name and property_value are compared. "
            "Use CONTAINS for substring matching, STARTS/ENDS for prefix/suffix matching. "
            "Use standard SQL operators: =, >, <, >=, <=, != for other properties.",
        )
  • Registration of the 'repository_object_search' tool via @mcp.tool decorator, inside register_search_tools() which is called from mcp_server_main.py.
    @mcp.tool(
        name="repository_object_search",
    )
    async def repository_object_search(
        search_parameters: SearchParameters,
    ) -> dict | ToolError:
        """
        **PREREQUISITES IN ORDER**: To use this tool, you MUST call two other tools first in a specific sequence.
        1. determine_class tool to get the class_name for search_class.
        2. get_searchable_property_descriptions to get a list of valid property_name for search_properties
    
        Description:
        This tool retrieves repository objects other than Document instances.
    
        :param search_parameters (SearchParameters): parameters for the searching including the object being searched for and any search conditions.
    
        :returns: A the repository object details, including:
            - repositoryObjects (dict): a dictionary containing independentObjects:
                - independentObjects (list): A list of independent objects, each containing:
                - properties (list): A list of properties, each containing:
                    - label (str): The name of the property.
                    - value (str): The value of the property.
        """
        return await get_repository_object_main(
            search_parameters, graphql_client, metadata_cache
        )
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It describes the retrieval and return structure, but does not explicitly state that the operation is non-destructive or mention any side effects. It covers the basic behavior adequately.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively long with a prerequisites section and detailed parameter/return documentation. It is front-loaded with prerequisites, but includes some redundancy with the schema. Could be more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with nested input and output schemas, the description covers the prerequisite sequence, parameter details, and return structure. However, it does not mention the behavior when search_properties is empty (return all objects) as noted in the schema, and the return description has a minor grammatical issue.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds some context by explaining the search_parameters nested object and the return structure, but does not provide significant new meaning beyond the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it retrieves repository objects other than Document instances, distinguishing it from sibling document_search. The verb 'retrieves' and the resource 'repository objects' are specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly lists prerequisites: must call determine_class and get_searchable_property_descriptions first. It implies this tool is for non-Document objects, providing some guidance on when to use, though no explicit exclusions or alternatives beyond the sibling context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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