Skip to main content
Glama
ibm-ecm

IBM Core Content Services MCP Server

Official
by ibm-ecm

delete_document_version

Destructive

Remove a specific document version from the content repository using its ID or path. The tool returns the deleted document identifier upon successful removal.

Instructions

Deletes a specific document version in the content repository.

: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 deleted Document id. 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 'delete_document_version' tool is registered as an MCP tool via the @mcp.tool decorator inside register_document_tools(), with a destructive hint annotation.
    @mcp.tool(
        name="delete_document_version",
        annotations=ToolAnnotations(destructiveHint=True),
    )
    async def delete_document_version(
        identifier: str,
    ) -> Union[str, ToolError]:
        """
        Deletes a specific document version in the content repository.
    
        :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 deleted Document id.
                 If unsuccessful, returns a ToolError with details about the failure.
        """
        method_name = "delete_document_version"
        try:
            # Delete only the specified version
            mutation = """
            mutation ($object_store_name: String!, $identifier: String!) {
              deleteDocument(
                repositoryIdentifier: $object_store_name
                identifier: $identifier
              ) {
                id
                className
              }
            }
            """
    
            # Prepare variables for the GraphQL query
            variables = {
                "object_store_name": graphql_client.object_store,
                "identifier": identifier,
            }
    
            # Execute the GraphQL mutation
            logger.info("Executing single document version deletion")
            response: Union[ToolError, Dict[str, Any]] = (
                await graphql_client_execute_async_wrapper(
                    logger,
                    method_name,
                    graphql_client,
                    query=mutation,
                    variables=variables,
                )
            )
            if isinstance(response, ToolError):
                return response
    
            # Create and return a Document instance from the response
            return response["data"]["deleteDocument"]["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 handler function 'delete_document_version' (async) takes an 'identifier' parameter (document ID or path) and executes a GraphQL 'deleteDocument' mutation to delete a specific document version. It returns the ID of the deleted document on success or a ToolError on failure.
    async def delete_document_version(
        identifier: str,
    ) -> Union[str, ToolError]:
        """
        Deletes a specific document version in the content repository.
    
        :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 deleted Document id.
                 If unsuccessful, returns a ToolError with details about the failure.
        """
        method_name = "delete_document_version"
        try:
            # Delete only the specified version
            mutation = """
            mutation ($object_store_name: String!, $identifier: String!) {
              deleteDocument(
                repositoryIdentifier: $object_store_name
                identifier: $identifier
              ) {
                id
                className
              }
            }
            """
    
            # Prepare variables for the GraphQL query
            variables = {
                "object_store_name": graphql_client.object_store,
                "identifier": identifier,
            }
    
            # Execute the GraphQL mutation
            logger.info("Executing single document version deletion")
            response: Union[ToolError, Dict[str, Any]] = (
                await graphql_client_execute_async_wrapper(
                    logger,
                    method_name,
                    graphql_client,
                    query=mutation,
                    variables=variables,
                )
            )
            if isinstance(response, ToolError):
                return response
    
            # Create and return a Document instance from the response
            return response["data"]["deleteDocument"]["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 GraphQL mutation schema used by delete_document_version: sends a 'deleteDocument' mutation with repositoryIdentifier and identifier, requesting id and className back.
    mutation = """
    mutation ($object_store_name: String!, $identifier: String!) {
      deleteDocument(
        repositoryIdentifier: $object_store_name
        identifier: $identifier
      ) {
        id
        className
      }
    }
    """
  • The 'register_document_tools' function (which registers delete_document_version) is called for the CORE server type and the FULL 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)
        # register_custom_object_tools(mcp, graphql_client)
        logger.info("Core tools registered")
    
    elif server_type == ServerType.AI__DOCUMENT_INSIGHT:
        register_advanced_search_tools(mcp, graphql_client, metadata_cache)
        register_vector_search_tool(mcp, graphql_client)
        logger.info("AI Document Insight tools registered")
    
    elif server_type == ServerType.LEGAL_HOLD:
        register_hold_tools(mcp, graphql_client)
        logger.info("Legal hold tools registered")
    
    elif server_type == ServerType.PROPERTY_EXTRACTION_AND_CLASSIFICATION:
        register_property_extraction_tools(mcp, graphql_client, metadata_cache)
        register_classification_tools(mcp, graphql_client, metadata_cache)
        logger.info("Property extraction and classification 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_custom_object_tools(mcp, graphql_client)
        register_vector_search_tool(mcp, graphql_client)
        register_advanced_search_tools(mcp, graphql_client, metadata_cache)
        register_annotation_tools(mcp, graphql_client)
    
        register_hold_tools(mcp, graphql_client)
        register_property_extraction_tools(mcp, graphql_client, metadata_cache)
        register_classification_tools(mcp, graphql_client, metadata_cache)
        logger.info("All tools registered")
Behavior4/5

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

The description adds return behavior ('returns the deleted Document id or ToolError') and explains the parameter, complementing the destructiveHint annotation. It does not cover permissions or side effects, but provides sufficient transparency for this simple tool.

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?

The description is concise and well-structured, using clear language and reStructuredText parameter documentation. It fits the purpose without unnecessary detail.

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 tool's simplicity, the description covers the essential aspects: purpose, parameter, and return values. However, it does not provide guidance on version numbering or prerequisites, which could be helpful in a repository context.

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 parameter 'identifier' is fully explained: it can be a GUID or path, with an example. This adds significant meaning beyond the bare schema, compensating for 0% schema description coverage.

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 'Deletes a specific document version', specifying the verb and resource. It distinguishes from sibling tools like 'delete_version_series' by focusing on a single version.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like delete_version_series or cancel_document_checkout. The description only states what the tool does, not when to prefer 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/ibm-content-services-mcp-server'

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