chroma_create_collection
Create a new Chroma collection with customizable HNSW parameters, embedding functions, and optional metadata to organize and manage AI-generated or user-input data efficiently.
Instructions
Create a new Chroma collection with configurable HNSW parameters.
Args:
collection_name: Name of the collection to create
embedding_function_name: Name of the embedding function to use. Options: 'default', 'cohere', 'openai', 'jina', 'voyageai', 'ollama', 'roboflow'
metadata: Optional metadata dict to add to the collection
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_name | Yes | ||
| embedding_function_name | No | default | |
| metadata | No |
Implementation Reference
- src/chroma_mcp/server.py:179-209 (handler)The handler function for 'chroma_create_collection' tool. It creates a new ChromaDB collection with the specified embedding function and metadata using the global Chroma client.@mcp.tool() async def chroma_create_collection( collection_name: str, embedding_function_name: str = "default", metadata: Dict | None = None, ) -> str: """Create a new Chroma collection with configurable HNSW parameters. Args: collection_name: Name of the collection to create embedding_function_name: Name of the embedding function to use. Options: 'default', 'cohere', 'openai', 'jina', 'voyageai', 'ollama', 'roboflow' metadata: Optional metadata dict to add to the collection """ client = get_chroma_client() embedding_function = mcp_known_embedding_functions[embedding_function_name] configuration=CreateCollectionConfiguration( embedding_function=embedding_function() ) try: client.create_collection( name=collection_name, configuration=configuration, metadata=metadata ) config_msg = f" with configuration: {configuration}" return f"Successfully created collection {collection_name}{config_msg}" except Exception as e: raise Exception(f"Failed to create collection '{collection_name}': {str(e)}") from e
- src/chroma_mcp/server.py:171-178 (helper)Dictionary of known embedding functions used by the chroma_create_collection handler to select the appropriate embedding function based on the input parameter.mcp_known_embedding_functions: Dict[str, EmbeddingFunction] = { "default": DefaultEmbeddingFunction, "cohere": CohereEmbeddingFunction, "openai": OpenAIEmbeddingFunction, "jina": JinaEmbeddingFunction, "voyageai": VoyageAIEmbeddingFunction, "roboflow": RoboflowEmbeddingFunction, }