Skip to main content
Glama

chroma_delete_documents

Remove specific documents from a Chroma collection by specifying their IDs and collection name. Confirms the number of documents deleted and handles errors for invalid inputs or non-existent collections.

Instructions

Delete documents from a Chroma collection.

Args:
    collection_name: Name of the collection to delete documents from
    ids: List of document IDs to delete

Returns:
    A confirmation message indicating the number of documents deleted.

Raises:
    ValueError: If 'ids' is empty
    Exception: If the collection does not exist or if the delete operation fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_nameYes
idsYes

Implementation Reference

  • The main handler function for the 'chroma_delete_documents' tool. It deletes specified documents by IDs from a Chroma collection using the ChromaDB client. Decorated with @mcp.tool() which also serves as the registration in FastMCP.
    @mcp.tool()
    async def chroma_delete_documents(
        collection_name: str,
        ids: List[str]
    ) -> str:
        """Delete documents from a Chroma collection.
    
        Args:
            collection_name: Name of the collection to delete documents from
            ids: List of document IDs to delete
    
        Returns:
            A confirmation message indicating the number of documents deleted.
    
        Raises:
            ValueError: If 'ids' is empty
            Exception: If the collection does not exist or if the delete operation fails.
        """
        if not ids:
            raise ValueError("The 'ids' list cannot be empty.")
    
        client = get_chroma_client()
        try:
            collection = client.get_collection(collection_name)
        except Exception as e:
            raise Exception(
                f"Failed to get collection '{collection_name}': {str(e)}"
            ) from e
    
        try:
            collection.delete(ids=ids)
            return (
                f"Successfully deleted {len(ids)} documents from "
                f"collection '{collection_name}'. Note: Non-existent IDs are ignored by ChromaDB."
            )
        except Exception as e:
            raise Exception(
                f"Failed to delete documents from collection '{collection_name}': {str(e)}"
            ) from e
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the destructive nature ('Delete'), error conditions (ValueError for empty ids, Exception for missing collection or operation failure), and return value (confirmation message with count). However, it lacks details on permissions, rate limits, or side effects beyond deletion.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded with the core purpose, followed by organized sections for Args, Returns, and Raises. Every sentence adds value, with no redundant or extraneous information, making it efficient and easy to parse.

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?

For a destructive tool with 2 parameters, 0% schema coverage, and no output schema, the description is largely complete: it covers purpose, parameters, errors, and return value. However, it could improve by mentioning sibling tools for context or detailing the confirmation message format, slightly reducing completeness.

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 schema description coverage is 0%, so the description must fully compensate. It clearly explains both parameters: 'collection_name' as the target collection and 'ids' as the list of document IDs to delete, including validation (ids cannot be empty). This adds essential meaning beyond the bare schema.

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 specific action ('Delete documents') and target resource ('from a Chroma collection'), distinguishing it from sibling tools like chroma_delete_collection (which deletes entire collections) and chroma_update_documents (which modifies rather than removes documents). The verb+resource combination is precise and unambiguous.

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

Usage Guidelines3/5

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

The description implies usage through its parameter explanations and error conditions (e.g., 'If the collection does not exist'), but it does not explicitly state when to use this tool versus alternatives like chroma_delete_collection or chroma_update_documents. The context is clear but lacks direct comparative guidance.

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

Related 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/chroma-core/chroma-mcp'

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