Skip to main content
Glama

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
NameRequiredDescriptionDefault
collection_nameYes
limitNo

Implementation Reference

  • 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
  • The @mcp.tool() decorator registers the 'chroma_peek_collection' function as an MCP tool.
    @mcp.tool()
  • 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

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