chroma_get_collection_info
Retrieve detailed information about a specific collection within the Chroma MCP Server, enabling users to analyze and manage data more effectively.
Instructions
Get information about a Chroma collection.
Args:
collection_name: Name of the collection to get info about
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_name | Yes |
Implementation Reference
- src/chroma_mcp/server.py:230-253 (handler)The main handler function for the 'chroma_get_collection_info' tool. It retrieves the collection using the Chroma client, gets the document count, peeks at sample documents, and returns a dictionary with name, count, and sample documents. The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool() async def chroma_get_collection_info(collection_name: str) -> Dict: """Get information about a Chroma collection. Args: collection_name: Name of the collection to get info about """ client = get_chroma_client() try: collection = client.get_collection(collection_name) # Get collection count count = collection.count() # Peek at a few documents peek_results = collection.peek(limit=3) return { "name": collection_name, "count": count, "sample_documents": peek_results } except Exception as e: raise Exception(f"Failed to get collection info for '{collection_name}': {str(e)}") from e