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
| Name | Required | Description | Default |
|---|---|---|---|
| collection_name | Yes | ||
| new_metadata | No | ||
| new_name | No |
Implementation Reference
- src/chroma_mcp/server.py:269-295 (handler)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