Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/chroma_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def get_chroma_client(args=None):

##### Collection Tools #####

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False})
async def chroma_list_collections(
limit: int | None = None,
offset: int | None = None
Expand Down Expand Up @@ -176,7 +176,7 @@ async def chroma_list_collections(
"voyageai": VoyageAIEmbeddingFunction,
"roboflow": RoboflowEmbeddingFunction,
}
@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": False})
async def chroma_create_collection(
collection_name: str,
embedding_function_name: str = "default",
Expand Down Expand Up @@ -208,7 +208,7 @@ async def chroma_create_collection(
except Exception as e:
raise Exception(f"Failed to create collection '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False})
async def chroma_peek_collection(
collection_name: str,
limit: int = 5
Expand All @@ -227,7 +227,7 @@ async def chroma_peek_collection(
except Exception as e:
raise Exception(f"Failed to peek collection '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False})
async def chroma_get_collection_info(collection_name: str) -> Dict:
"""Get information about a Chroma collection.

Expand All @@ -252,7 +252,7 @@ async def chroma_get_collection_info(collection_name: str) -> Dict:
except Exception as e:
raise Exception(f"Failed to get collection info for '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False})
async def chroma_get_collection_count(collection_name: str) -> int:
"""Get the number of documents in a Chroma collection.

Expand All @@ -266,7 +266,7 @@ async def chroma_get_collection_count(collection_name: str) -> int:
except Exception as e:
raise Exception(f"Failed to get collection count for '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": False})
async def chroma_modify_collection(
collection_name: str,
new_name: str | None = None,
Expand Down Expand Up @@ -294,7 +294,7 @@ async def chroma_modify_collection(
except Exception as e:
raise Exception(f"Failed to modify collection '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": False})
async def chroma_fork_collection(
collection_name: str,
new_collection_name: str,
Expand All @@ -314,7 +314,7 @@ async def chroma_fork_collection(
except Exception as e:
raise Exception(f"Failed to fork collection '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": True})
async def chroma_delete_collection(collection_name: str) -> str:
"""Delete a Chroma collection.

Expand All @@ -329,7 +329,7 @@ async def chroma_delete_collection(collection_name: str) -> str:
raise Exception(f"Failed to delete collection '{collection_name}': {str(e)}") from e

##### Document Tools #####
@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": False})
async def chroma_add_documents(
collection_name: str,
documents: List[str],
Expand Down Expand Up @@ -392,7 +392,7 @@ async def chroma_add_documents(
except Exception as e:
raise Exception(f"Failed to add documents to collection '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False})
async def chroma_query_documents(
collection_name: str,
query_texts: List[str],
Expand Down Expand Up @@ -439,7 +439,7 @@ async def chroma_query_documents(
except Exception as e:
raise Exception(f"Failed to query documents from collection '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False})
async def chroma_get_documents(
collection_name: str,
ids: List[str] | None = None,
Expand Down Expand Up @@ -489,7 +489,7 @@ async def chroma_get_documents(
except Exception as e:
raise Exception(f"Failed to get documents from collection '{collection_name}': {str(e)}") from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": False})
async def chroma_update_documents(
collection_name: str,
ids: List[str],
Expand Down Expand Up @@ -564,7 +564,7 @@ async def chroma_update_documents(
f"Failed to update documents in collection '{collection_name}': {str(e)}"
) from e

@mcp.tool()
@mcp.tool(annotations={"readOnlyHint": False, "destructiveHint": True})
async def chroma_delete_documents(
collection_name: str,
ids: List[str]
Expand Down