Skip to main content
Glama
ibm-ecm

Core Content Services MCP Server

Official
by ibm-ecm

delete_folder

Deletes a folder from the content repository using its unique identifier or path. Returns the folder ID on success.

Instructions

Deletes a folder in the content repository. This tool interfaces with the GraphQL API to delete a folder object with the provided id.

:param id_or_path string Yes The unique identifier or path for the folder. If not provided, an error will be returned.

:returns: If successful, return the folder id. Else, return a ToolError instance that describes the error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
id_or_pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The register_folder_tools function that registers all folder tools including delete_folder on the FastMCP server instance.
    def register_folder_tools(mcp: FastMCP, graphql_client: GraphQLClient) -> None:
        @mcp.tool(
            name="create_folder",
  • The delete_folder tool handler decorated with @mcp.tool(name='delete_folder'). Takes an id_or_path string, validates input, executes a GraphQL deleteFolder mutation, and returns the folder ID or a ToolError on failure.
    @mcp.tool(
        name="delete_folder",
    )
    def delete_folder(id_or_path: str) -> Union[str, ToolError]:
        """
        Deletes a folder in the content repository. This tool interfaces with the GraphQL API
        to delete a folder object with the provided id.
    
    
        :param id_or_path	string	Yes	The unique identifier or path for the folder. If not provided, an error will be returned.
    
        :returns: If successful, return the folder id.
         Else, return a ToolError instance that describes the error.
        """
        method_name = "delete_folder"
        try:
            # check id or path
            if not id_or_path:
                return ToolError(
                    message=f"delete_folder failed: id is a required input.",
                )
    
            mutation = """
                    mutation deleteFolder( $id_or_path:String!
                    $repo: String!)
                    {
                    deleteFolder(repositoryIdentifier: $repo, 
                        identifier: $id_or_path
                    )
                    {
                        id
                        className
                    }
                    }
            """
            var = {
                "repo": graphql_client.object_store,
                "id_or_path": id_or_path,
            }
            response = graphql_client.execute(query=mutation, variables=var)
            # handling exception, for example duplicate folder name
            if "errors" in response:
                return ToolError(
                    message=f"delete_folder failed: got err {response}.",
                )
    
            return response["data"]["deleteFolder"]["id"]
    
        except Exception as e:
            error_traceback = traceback.format_exc(limit=TRACEBACK_LIMIT)
            logger.error(
                f"{method_name} failed: {e.__class__.__name__} - {str(e)}\n{error_traceback}"
            )
    
            return ToolError(
                message=f"{method_name} failed: got err {e}. Trace available in server logs.",
            )
  • GraphQL mutation used by delete_folder to delete a folder via the deleteFolder mutation with repository and identifier arguments.
    mutation = """
            mutation deleteFolder( $id_or_path:String!
            $repo: String!)
            {
            deleteFolder(repositoryIdentifier: $repo, 
                identifier: $id_or_path
            )
            {
                id
                className
            }
            }
    """
  • Import of register_folder_tools from cs_mcp_server.tools.folders in the main server file.
    from cs_mcp_server.tools.folders import register_folder_tools
    from cs_mcp_server.tools.annotations import register_annotation_tools
    from cs_mcp_server.tools.property_extraction import register_property_extraction_tools
    from cs_mcp_server.tools.classification import register_classification_tools
  • Registration calls to register_folder_tools for both CORE and FULL server types.
    # 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)
        # 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)
Behavior2/5

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

With no annotations, the description must disclose side effects. It only states it deletes a folder but does not specify whether contents are also deleted, permission requirements, or if the operation is reversible. Inadequate for a delete action.

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 moderately concise but includes docstring formatting and a param line that could be integrated more cleanly. It is not excessively long, but could be tighter.

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

Completeness2/5

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

Missing critical context: what happens to subfolders/files, whether it's a soft or permanent delete, permission requirements, and error conditions beyond a generic ToolError. Incomplete for a delete operation.

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

Parameters2/5

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

The parameter 'id_or_path' has 0% schema description coverage; the description repeats it is an identifier/path and that omitting it causes an error. It does not explain format, examples, or how to differentiate between id and path, adding minimal value.

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?

Clearly states 'Deletes a folder in the content repository', specifying the verb and resource. Distinguishes from sibling tools like create_folder, update_folder, and get_folder_detail.

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 on when to use this tool vs alternatives, no prerequisites (e.g., folder must be empty), and no when-not-to-use conditions. For a destructive operation, this is insufficient.

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