Skip to main content
Glama
ibm-ecm

Core Content Services MCP Server

Official
by ibm-ecm

get_document_versions

Retrieve the complete version series of a document—including past, current, and future versions—by providing its ID or path.

Instructions

Retrieves all versions in the version series that includes the specified document. This returns all versions (past, current, and future) that belong to the same version series.

: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 dictionary containing the version series details, including: - versionSeries (dict): A dictionary containing version series details, including: - versions (list): A list of all versions in the series, with each version containing: - versionables (list): A list of versionable objects, each containing: - majorVersionNumber (int): The major version number. The format to print out version number is majorVersionNumber.minorVersionNumber. - minorVersionNumber (int): The minor version number. The format to print out version number is majorVersionNumber.minorVersionNumber. - id (str): The unique identifier of the version's document id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool 'get_document_versions' is registered via the @mcp.tool decorator in register_document_tools() function
    @mcp.tool(
        name="get_document_versions",
    )
    async def get_document_versions(identifier: str) -> dict:
        """
        Retrieves all versions in the version series that includes the specified document.
        This returns all versions (past, current, and future) that belong to the same version series.
    
        :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 dictionary containing the version series details, including:
            - versionSeries (dict): A dictionary containing version series details, including:
                - versions (list): A list of all versions in the series, with each version containing:
                    - versionables (list): A list of versionable objects, each containing:
                        - majorVersionNumber (int): The major version number. The format to print out version number is majorVersionNumber.minorVersionNumber.
                        - minorVersionNumber (int): The minor version number. The format to print out version number is majorVersionNumber.minorVersionNumber.
                        - id (str): The unique identifier of the version's document id.
        """
        query = """
        query getDocumentVersions($object_store_name: String!, $identifier: String!){
            document(
                repositoryIdentifier: $object_store_name
                identifier: $identifier
            ) {
                versionSeries {
                    versions {
                        versionables {
                            id
                            majorVersionNumber
                            minorVersionNumber
                        }
                    }
                }
            }
        }
        """
    
        variables = {
            "identifier": identifier,
            "object_store_name": graphql_client.object_store,
        }
    
        return await graphql_client.execute_async(query=query, variables=variables)
  • Handler function that executes the tool logic: executes a GraphQL query to retrieve all versions in the version series for the specified document
    async def get_document_versions(identifier: str) -> dict:
        """
        Retrieves all versions in the version series that includes the specified document.
        This returns all versions (past, current, and future) that belong to the same version series.
    
        :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 dictionary containing the version series details, including:
            - versionSeries (dict): A dictionary containing version series details, including:
                - versions (list): A list of all versions in the series, with each version containing:
                    - versionables (list): A list of versionable objects, each containing:
                        - majorVersionNumber (int): The major version number. The format to print out version number is majorVersionNumber.minorVersionNumber.
                        - minorVersionNumber (int): The minor version number. The format to print out version number is majorVersionNumber.minorVersionNumber.
                        - id (str): The unique identifier of the version's document id.
        """
        query = """
        query getDocumentVersions($object_store_name: String!, $identifier: String!){
            document(
                repositoryIdentifier: $object_store_name
                identifier: $identifier
            ) {
                versionSeries {
                    versions {
                        versionables {
                            id
                            majorVersionNumber
                            minorVersionNumber
                        }
                    }
                }
            }
        }
        """
    
        variables = {
            "identifier": identifier,
            "object_store_name": graphql_client.object_store,
        }
    
        return await graphql_client.execute_async(query=query, variables=variables)
  • Input schema: takes a single 'identifier' parameter (string) - the document id or path. Returns a dict containing version series details.
    @mcp.tool(
        name="get_document_versions",
    )
    async def get_document_versions(identifier: str) -> dict:
        """
        Retrieves all versions in the version series that includes the specified document.
        This returns all versions (past, current, and future) that belong to the same version series.
    
        :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 dictionary containing the version series details, including:
            - versionSeries (dict): A dictionary containing version series details, including:
                - versions (list): A list of all versions in the series, with each version containing:
                    - versionables (list): A list of versionable objects, each containing:
                        - majorVersionNumber (int): The major version number. The format to print out version number is majorVersionNumber.minorVersionNumber.
                        - minorVersionNumber (int): The minor version number. The format to print out version number is majorVersionNumber.minorVersionNumber.
                        - id (str): The unique identifier of the version's document id.
        """
        query = """
        query getDocumentVersions($object_store_name: String!, $identifier: String!){
            document(
                repositoryIdentifier: $object_store_name
                identifier: $identifier
            ) {
                versionSeries {
                    versions {
                        versionables {
                            id
                            majorVersionNumber
                            minorVersionNumber
                        }
                    }
                }
            }
        }
        """
    
        variables = {
            "identifier": identifier,
            "object_store_name": graphql_client.object_store,
        }
    
        return await graphql_client.execute_async(query=query, variables=variables)
Behavior4/5

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

Without annotations, the description adequately discloses behavior: it retrieves all versions without modification. It explains the scope of the version series and the nature of the response, making the tool's effect clear.

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 detailed but somewhat verbose, especially the return structure. While clear, it could be more concise without losing essential information. However, it is well-organized and front-loaded with the purpose.

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?

Given the simple input schema and the presence of an output schema, the description provides sufficient context. It explains the return structure in detail, compensating for the output schema not being shown. It covers the essential use case.

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

Parameters5/5

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

The description thoroughly explains the 'identifier' parameter, noting it can be a document ID or path. This adds significant meaning beyond the input schema's type definition (string). No parameters are undocumented in the description.

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 the tool retrieves all versions in the version series for a specified document. This verb+resource definition distinguishes it from sibling tools like delete_document_version or get_document_properties.

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 explains that this tool returns past, current, and future versions in the same series. It provides context for when to use it, though it does not explicitly exclude alternatives or mention when not to use it.

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/cs-mcp-server'

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