Skip to main content
Glama
ibm-ecm

IBM Core Content Services MCP Server

Official
by ibm-ecm

get_document_properties

Retrieve a document's properties from the repository by providing its ID or file path. Get metadata directly without searching by other criteria.

Instructions

Retrieves a document's properties from the content repository by ID or path.

Note: Use this tool ONLY when you need to retrieve a document using its ID or file path. For searching documents by other properties, use the repository_search tool instead.

: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: If successful, returns the Document object with its properties. If unsuccessful, returns a ToolError with details about the failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'get_document_properties' tool handler function. It is an async function registered with @mcp.tool(name='get_document_properties') that takes an identifier (GUID or path), executes a GraphQL query to fetch document properties (id, name, properties), and returns a Document object or ToolError.
    @mcp.tool(
        name="get_document_properties",
    )
    async def get_document_properties(
        identifier: str,
    ) -> Union[Document, ToolError]:
        """
        Retrieves a document's properties from the content repository by ID or path.
    
        Note: Use this tool ONLY when you need to retrieve a document using its ID or file path.
        For searching documents by other properties, use the repository_search tool instead.
    
        :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: If successful, returns the Document object with its properties.
                 If unsuccessful, returns a ToolError with details about the failure.
        """
        method_name = "get_document"
        try:
            # Prepare the query
            query = """
            query ($object_store_name: String!, $identifier: String!) {
                document(repositoryIdentifier: $object_store_name, identifier: $identifier) {
                    id
                    name
                    properties {
                        id
                        value
                    }
                }
            }
            """
    
            # Prepare variables for the GraphQL query
            variables = {
                "object_store_name": graphql_client.object_store,
                "identifier": identifier,
            }
    
            # Execute the GraphQL query
            logger.info("Executing document retrieval")
            response: Union[ToolError, Dict[str, Any]] = (
                await graphql_client_execute_async_wrapper(
                    logger,
                    method_name,
                    graphql_client,
                    query=query,
                    variables=variables,
                )
            )
            if isinstance(response, ToolError):
                return response
    
            # Check if document was found
            if not response.get("data") or not response["data"].get("document"):
                return ToolError(
                    message=f"Document not found with identifier: {identifier}",
                    suggestions=[
                        "Check if the document ID or path is correct",
                        "Verify that the document exists in the repository",
                        "Try using repository_search tool to find the document by other properties",
                    ],
                )
    
            # Create and return a Document instance from the response
            return Document.create_an_instance(
                graphQL_changed_object_dict=response["data"]["document"],
                class_identifier=response["data"]["document"].get(
                    "className", DEFAULT_DOCUMENT_CLASS
                ),
            )
    
        except Exception as e:
            logger.error("%s failed: %s", method_name, str(e))
            logger.error(traceback.format_exc())
            return ToolError(
                message=f"{method_name} failed: {str(e)}. Trace available in server logs."
            )
  • The tool is registered via the @mcp.tool decorator with name='get_document_properties' inside the register_document_tools() function.
    @mcp.tool(
        name="get_document_properties",
    )
  • The register_document_tools function is called from mcp_server_main.py during server setup for both CORE and FULL server types.
    if server_type == ServerType.CORE:
        register_document_tools(mcp, graphql_client, metadata_cache)
  • The DocumentPropertiesInput class used as an input schema for document properties in several tools (create, update, etc.). It defines fields like properties, name, owner, content, mimeType, etc.
    class DocumentPropertiesInput(CustomInputBase):
        """Input for document properties."""
    
        properties: Optional[List[PropertyIdentifierAndScalarValue]] = Field(
            default=None, description="Properties for Document"
        )
        name: Optional[str] = Field(
            default=None,
            description="Name sets DocumentTitle or whatever property is configured as the Name property",
        )
        owner: Optional[str] = Field(default=None, description="Owner")
        content: Optional[str] = Field(
            default=None,
            description="Content can be specified if this represents a Reservation document or document creation",
        )
        mimeType: Optional[str] = Field(default=None, description="Mime type")
        compoundDocumentState: Optional[str] = Field(
            default=None, description="Compound document state"
        )
        cmRetentionDate: Optional[datetime] = Field(
            default=None, description="Retention date"
        )
        # contentElements field removed from the model to prevent agents from interpreting and creating this field
        # Instead, we use the methods from CustomInputBase to add content elements programmatically
    
        # Commented out references to ObjectReferenceInput, PermissionListInput, ObjectPropertyInput
        """
        objectProperties: Optional[List[ObjectPropertyInput]] = Field(
            default=None, description="Object properties"
        )
        replicationGroup: Optional[ObjectReferenceInput] = Field(
            default=None, description="Replication group"
        )
        permissions: Optional[PermissionListInput] = Field(
            default=None, description="Permissions"
        )
        securityPolicy: Optional[ObjectReferenceInput] = Field(
            default=None, description="Security policy"
        )
        securityFolder: Optional[ObjectReferenceInput] = Field(
            default=None, description="Security folder"
        )
        storagePolicy: Optional[ObjectReferenceInput] = Field(
            default=None, description="Storage policy"
        )
        documentLifecyclePolicy: Optional[ObjectReferenceInput] = Field(
            default=None, description="Document lifecycle policy"
        )
        storageArea: Optional[ObjectReferenceInput] = Field(
            default=None, description="Storage area"
        )
        """
  • The get_document_text_extract_content helper function used by property_extraction tool to retrieve document text extract content. Related utility for the document tools.
    async def get_document_text_extract_content(
        graphql_client: GraphQLClient, identifier: str
    ) -> str:
        """
        Retrieves a document's text extract content.
    
        This utility function queries the document's annotations, filters for text extract
        annotations, and downloads the text content from each annotation's content elements.
    
        :param graphql_client: GraphQL client instance
        :param identifier: The document id or path (GUID or repository path)
        :returns: The concatenated text content from all text extract annotations.
                 Returns empty string if no text extract is found.
        """
        query = """
        query getDocumentTextExtract($object_store_name: String!, $identifier: String!) {
            document(repositoryIdentifier: $object_store_name, identifier: $identifier) {
                annotations{
                    annotations{
                        id
                        name
                        className
                        annotatedContentElement
                        descriptiveText
                        contentElements{
                            ... on ContentTransfer{
                                downloadUrl
                                retrievalName
                                contentSize
                            }
                        }
                    }
                }
            }
        }
        """
    
        variables = {
            "identifier": identifier,
Behavior2/5

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

No annotations provided, so description carries burden. Describes input and output but does not disclose behavioral traits such as read-only nature, permission requirements, side effects, rate limits, or performance characteristics. Minimal transparency beyond basic operation.

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

Conciseness4/5

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

Description is clear and well-structured with a main sentence, usage note, and parameter/return details. Slightly verbose with param/returns section but still concise overall.

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

Completeness3/5

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

Covers purpose, usage guidance, parameter, and return format. For a simple retrieval tool, this is adequate. However, lacks behavioral context (read-only, permissions) and does not address all sibling distinctions. Output schema exists but description doesn't explain it further.

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

Parameters4/5

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

Schema has single parameter 'identifier' with no description (0% coverage). Description adds clear semantics: 'The document id or path (required). This can be either the document's ID (GUID) or its path in the repository.' Compensates well for missing schema documentation.

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?

States explicit action 'retrieves a document's properties' and specifies the resource 'from the content repository by ID or path'. Distinguishes from sibling tools by noting alternative use case for repository_search.

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?

Explicitly states when to use this tool ('ONLY when you need to retrieve a document using its ID or file path') and provides alternative (repository_search). However, does not mention other similar siblings like lookup_documents_by_name or lookup_documents_by_path.

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