Skip to main content
Glama
ibm-ecm

IBM Core Content Services MCP Server

Official
by ibm-ecm

delete_version_series

Remove all versions of a document from IBM Content Manager by specifying the version series ID to permanently delete the entire document history.

Instructions

Deletes an entire version series (all versions of a document) in the content repository.

:param version_series_id: The version series ID (GUID) to delete. If you don't have the version series ID, first call get_document_property on the document to get the version series ID.

:returns: If successful, returns the deleted version series ID as a string. If unsuccessful, returns a ToolError with details about the failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
version_series_idYes

Implementation Reference

  • The core handler implementation for the 'delete_version_series' tool. It is decorated with @mcp.tool to register it and executes a GraphQL mutation to delete the specified version series.
    @mcp.tool(
        name="delete_version_series", annotations=ToolAnnotations(destructiveHint=True)
    )
    async def delete_version_series(
        version_series_id: str,
    ) -> Union[str, ToolError]:
        """
        Deletes an entire version series (all versions of a document) in the content repository.
    
        :param version_series_id: The version series ID (GUID) to delete. If you don't have the version series ID,
                                 first call get_document_property on the document to get the version series ID.
    
        :returns: If successful, returns the deleted version series ID as a string.
                 If unsuccessful, returns a ToolError with details about the failure.
        """
        method_name = "delete_version_series"
        try:
            # Prepare the mutation to delete the version series
            mutation = """
            mutation ($object_store_name: String!, $identifier: String!) {
              deleteVersionSeries(
                repositoryIdentifier: $object_store_name
                identifier: $identifier
              ) {
                id
                className
              }
            }
            """
    
            # Prepare variables for the GraphQL mutation
            variables = {
                "object_store_name": graphql_client.object_store,
                "identifier": version_series_id,
            }
    
            # Execute the GraphQL mutation
            logger.info("Executing version series deletion")
            response = await graphql_client.execute_async(
                query=mutation, variables=variables
            )
    
            # Handle errors
            if "errors" in response:
                logger.error("GraphQL error: %s", response["errors"])
                return ToolError(message=f"{method_name} failed: {response['errors']}")
    
            # Return just the id as a string
            return response["data"]["deleteVersionSeries"]["id"]
    
        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 register_server_tools function calls register_document_tools (which defines the tool) for CORE and FULL server types, effectively registering the delete_version_series tool with the MCP server.
    def register_server_tools(
        graphql_client: GraphQLClient,
        metadata_cache: MetadataCache,
        server_type: ServerType,
    ) -> None:
        """
        Register tools based on the server type.
    
        Args:
            graphql_client: The initialized GraphQL client
            metadata_cache: The metadata cache instance
            server_type: The type of server (ServerType enum)
        """
        # Ensure mcp is initialized (type narrowing for type checker)
        assert mcp is not None
    
        logger.info("Registering tools for %s server", server_type.value)
    
        # Register tools based on server type
        if server_type == ServerType.CORE:
            register_document_tools(mcp, graphql_client, metadata_cache)
            register_folder_tools(mcp, graphql_client)
            register_class_tools(mcp, graphql_client, metadata_cache)
            register_search_tools(mcp, graphql_client, metadata_cache)
            register_annotation_tools(mcp, graphql_client)
            logger.info("Core tools registered")
    
        elif server_type == ServerType.VECTOR_SEARCH:
            register_vector_search_tool(mcp, graphql_client)
            logger.info("Vector search tools registered")
    
        elif server_type == ServerType.LEGAL_HOLD:
            register_legalhold(mcp, graphql_client)
            logger.info("Legal hold tools registered")
    
        elif server_type == ServerType.FULL:
            register_document_tools(mcp, graphql_client, metadata_cache)
            register_folder_tools(mcp, graphql_client)
            register_class_tools(mcp, graphql_client, metadata_cache)
            register_search_tools(mcp, graphql_client, metadata_cache)
            register_annotation_tools(mcp, graphql_client)
            register_vector_search_tool(mcp, graphql_client)
            register_legalhold(mcp, graphql_client)
            logger.info("All tools registered")
    
        else:
            raise ValueError(f"Unknown server type: {server_type}")

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