chroma_peek_collection
Inspect documents within a specified Chroma collection by specifying the collection name and desired document limit. Enables quick viewing of data stored in the database.
Instructions
Peek at documents in a Chroma collection.
Args:
collection_name: Name of the collection to peek into
limit: Number of documents to peek at
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection_name | Yes | ||
| limit | No |
Implementation Reference
- src/chroma_mcp/server.py:211-228 (handler)The handler function for 'chroma_peek_collection' tool. Decorated with @mcp.tool() for registration. Fetches the Chroma client, gets the collection by name, peeks at up to 'limit' documents, and returns the results.@mcp.tool() async def chroma_peek_collection( collection_name: str, limit: int = 5 ) -> Dict: """Peek at documents in a Chroma collection. Args: collection_name: Name of the collection to peek into limit: Number of documents to peek at """ client = get_chroma_client() try: collection = client.get_collection(collection_name) results = collection.peek(limit=limit) return results except Exception as e: raise Exception(f"Failed to peek collection '{collection_name}': {str(e)}") from e
- src/chroma_mcp/server.py:211-211 (registration)The @mcp.tool() decorator registers the 'chroma_peek_collection' function as an MCP tool.@mcp.tool()
- src/chroma_mcp/server.py:212-220 (schema)Input schema defined by function parameters (collection_name: str, limit: int=5) and docstring. Output is Dict from Chroma peek().async def chroma_peek_collection( collection_name: str, limit: int = 5 ) -> Dict: """Peek at documents in a Chroma collection. Args: collection_name: Name of the collection to peek into limit: Number of documents to peek at