Skip to main content
Glama

chroma_modify_collection

Update the name or metadata of a Chroma collection to maintain accurate and relevant data organization for efficient retrieval and management within the Chroma MCP Server.

Instructions

Modify a Chroma collection's name or metadata.

Args:
    collection_name: Name of the collection to modify
    new_name: Optional new name for the collection
    new_metadata: Optional new metadata for the collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_nameYes
new_metadataNo
new_nameNo

Implementation Reference

  • The primary handler function for the 'chroma_modify_collection' tool. It retrieves the collection using get_chroma_client(), calls collection.modify() with optional new_name and/or new_metadata, determines modified aspects, and returns a success message. Decorated with @mcp.tool() for automatic registration and schema inference.
    @mcp.tool()
    async def chroma_modify_collection(
        collection_name: str,
        new_name: str | None = None,
        new_metadata: Dict | None = None,
    ) -> str:
        """Modify a Chroma collection's name or metadata.
        
        Args:
            collection_name: Name of the collection to modify
            new_name: Optional new name for the collection
            new_metadata: Optional new metadata for the collection
        """
        client = get_chroma_client()
        try:
            collection = client.get_collection(collection_name)
            collection.modify(name=new_name, metadata=new_metadata)
            
            modified_aspects = []
            if new_name:
                modified_aspects.append("name")
            if new_metadata:
                modified_aspects.append("metadata")
            
            return f"Successfully modified collection {collection_name}: updated {' and '.join(modified_aspects)}"
        except Exception as e:
            raise Exception(f"Failed to modify collection '{collection_name}': {str(e)}") from e

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