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
| Name | Required | Description | Default |
|---|---|---|---|
| identifier | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/cs_mcp_server/tools/documents.py:63-106 (registration)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)