Skip to content
Merged
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
12 changes: 12 additions & 0 deletions packages/mcp/src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,18 @@ export class ToolHandlers {
console.log(`[SEARCH] ✅ Search completed! Found ${searchResults.length} results using ${embeddingProvider.getProvider()} embeddings`);

if (searchResults.length === 0) {
// Check if collection was lost (indexed locally but missing in Milvus)
if (isIndexed && !isIndexing) {
const collectionName = this.context.getCollectionName(absolutePath);
const hasCollection = await this.context.getVectorDatabase().hasCollection(collectionName);
if (!hasCollection) {
return {
content: [{ type: "text", text: `Error: Index data for '${absolutePath}' has been lost (collection not found in Milvus). Please re-index using index_codebase with force=true.` }],
isError: true
};
}
}

let noResultsMessage = `No results found for query: "${query}" in codebase '${absolutePath}'`;
if (isIndexing) {
noResultsMessage += `\n\nNote: This codebase is still being indexed. Try searching again after indexing completes, or the query may not match any indexed content.`;
Expand Down
Loading