From 7703b2212b860f7a28fe116a347a9bd8ce1aaa11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=81ukawski?= Date: Fri, 13 Dec 2024 17:03:51 +0100 Subject: [PATCH] Return an empty list if there are no memories available --- src/mcp_server_qdrant/qdrant.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mcp_server_qdrant/qdrant.py b/src/mcp_server_qdrant/qdrant.py index b848045..520cf81 100644 --- a/src/mcp_server_qdrant/qdrant.py +++ b/src/mcp_server_qdrant/qdrant.py @@ -40,10 +40,14 @@ class QdrantConnector: async def find_memories(self, query: str) -> list[str]: """ - Find memories in the Qdrant collection. + Find memories in the Qdrant collection. If there are no memories found, an empty list is returned. :param query: The query to use for the search. :return: A list of memories found. """ + collection_exists = await self._client.collection_exists(self._collection_name) + if not collection_exists: + return [] + search_results = await self._client.query( self._collection_name, query_text=query,