Skip to content

Commit 89efe96

Browse files
committed
[ENH] Add support for collection.fork, update tool prompts with regex
1 parent 078dc67 commit 89efe96

File tree

4 files changed

+52
-12
lines changed

4 files changed

+52
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.6] - 08/14/2025
9+
10+
- Update chromadb to 1.0.16
11+
- Add tool prompts for regex support
12+
- Add new `chroma_fork_collection` tool support
13+
814
## [0.2.5] - 06/18/2025
915

1016
- Update chromadb to 1.0.13

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "chroma-mcp"
3-
version = "0.2.5"
3+
version = "0.2.6"
44
description = "Chroma MCP Server - Vector Database Integration for LLM Applications"
55
readme = "README.md"
66
requires-python = ">=3.10"
@@ -16,7 +16,7 @@ classifiers = [
1616
"Topic :: Software Development :: Libraries :: Python Modules"
1717
]
1818
dependencies = [
19-
"chromadb>=1.0.13",
19+
"chromadb>=1.0.16",
2020
"cohere>=5.14.2",
2121
"httpx>=0.28.1",
2222
"mcp[cli]>=1.2.1",

src/chroma_mcp/server.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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()
298318
async 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

uv.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)