@@ -293,7 +293,27 @@ async def chroma_modify_collection(
293293 return f"Successfully modified collection { collection_name } : updated { ' and ' .join (modified_aspects )} "
294294 except Exception as e :
295295 raise Exception (f"Failed to modify collection '{ collection_name } ': { str (e )} " ) from e
296-
296+
297+ @mcp .tool ()
298+ async def chroma_fork_collection (
299+ collection_name : str ,
300+ new_collection_name : str ,
301+ ) -> str :
302+ """Fork a Chroma collection.
303+
304+ Args:
305+ collection_name: Name of the collection to fork
306+ new_collection_name: Name of the new collection to create
307+ metadata: Optional metadata dict to add to the new collection
308+ """
309+ client = get_chroma_client ()
310+ try :
311+ collection = client .get_collection (collection_name )
312+ collection .fork (new_collection_name )
313+ return f"Successfully forked collection { collection_name } to { new_collection_name } "
314+ except Exception as e :
315+ raise Exception (f"Failed to fork collection '{ collection_name } ': { str (e )} " ) from e
316+
297317@mcp .tool ()
298318async def chroma_delete_collection (collection_name : str ) -> str :
299319 """Delete a Chroma collection.
@@ -394,6 +414,13 @@ async def chroma_query_documents(
394414 - Logical AND: {"$and": [{"field1": {"$eq": "value1"}}, {"field2": {"$gt": 5}}]}
395415 - Logical OR: {"$or": [{"field1": {"$eq": "value1"}}, {"field1": {"$eq": "value2"}}]}
396416 where_document: Optional document content filters
417+ Examples:
418+ - Contains: {"$contains": "value"}
419+ - Not contains: {"$not_contains": "value"}
420+ - Regex: {"$regex": "[a-z]+"}
421+ - Not regex: {"$not_regex": "[a-z]+"}
422+ - Logical AND: {"$and": [{"$contains": "value1"}, {"$not_regex": "[a-z]+"}]}
423+ - Logical OR: {"$or": [{"$regex": "[a-z]+"}, {"$not_contains": "value2"}]}
397424 include: List of what to include in response. By default, this will include documents, metadatas, and distances.
398425 """
399426 if not query_texts :
@@ -434,6 +461,13 @@ async def chroma_get_documents(
434461 - Logical AND: {"$and": [{"field1": {"$eq": "value1"}}, {"field2": {"$gt": 5}}]}
435462 - Logical OR: {"$or": [{"field1": {"$eq": "value1"}}, {"field1": {"$eq": "value2"}}]}
436463 where_document: Optional document content filters
464+ Examples:
465+ - Contains: {"$contains": "value"}
466+ - Not contains: {"$not_contains": "value"}
467+ - Regex: {"$regex": "[a-z]+"}
468+ - Not regex: {"$not_regex": "[a-z]+"}
469+ - Logical AND: {"$and": [{"$contains": "value1"}, {"$not_regex": "[a-z]+"}]}
470+ - Logical OR: {"$or": [{"$regex": "[a-z]+"}, {"$not_contains": "value2"}]}
437471 include: List of what to include in response. By default, this will include documents, and metadatas.
438472 limit: Optional maximum number of documents to return
439473 offset: Optional number of documents to skip before returning results
0 commit comments