-
Notifications
You must be signed in to change notification settings - Fork 137
feat: adds support for dropping vector search indexes in drop-index tool MCP-239 #642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new drop-search-index
tool for dropping search indexes from MongoDB collections. The tool is currently restricted to test environments and includes elicitation (confirmation) functionality for safety.
- Introduces a new
drop-search-index
tool with proper validation, error handling, and elicitation support - Refactors existing search index functionality to support code reuse between list and drop operations
- Adds comprehensive test coverage including unit, integration, and elicitation tests
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/tools/mongodb/delete/dropSearchIndex.ts | New tool implementation for dropping search indexes with validation and confirmation |
src/tools/mongodb/search/listSearchIndexes.ts | Refactored to extract reusable search index retrieval logic |
src/tools/mongodb/tools.ts | Added the new tool to the exports list |
src/common/config.ts | Added drop-search-index to confirmation required tools list |
tests/integration/tools/mongodb/delete/dropSearchIndex.test.ts | Comprehensive test suite for the new tool |
tests/integration/tools/mongodb/search/listSearchIndexes.test.ts | Updated to use refactored helper functions |
tests/integration/helpers.ts | Added reusable helper functions for search index operations |
tests/integration/tools/mongodb/mongodbClusterProcess.ts | Added directConnection parameter to connection string |
4e0e3e0
to
3df48c4
Compare
Pull Request Test Coverage Report for Build 18466847504Details
💛 - Coveralls |
10f49db
to
d6f1b91
Compare
- Tool is currently only visible to tests - Tool has been added to the list of tools requiring elicitation - Tests have been added for basic tool functionality and elicitation - listSearchIndexes tool and its tests have been modified to re-use some of the existing code.
1. Wraps the toolcall result in untrusted data wrapper 2. Add additional test for confirming that we don't drop when confirmation is not provided
effaac6
to
7d795ca
Compare
() => runningContainer.stop(), | ||
() => `mongodb://${runningContainer.getHost()}:${runningContainer.getMappedPort(27017)}` | ||
() => | ||
`mongodb://${runningContainer.getHost()}:${runningContainer.getMappedPort(27017)}/?directConnection=true` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the direct connection here? It shouldn't be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it is. Without it the connection just keeps hanging because driver tries to resolve involved clusters and since the internal ports are never exposed the driver is unable to connect. BTW this is also what is recommended by the CLI when you kick start a deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that in your PR you're using the service provider from server instance itself and because our connection code handles it internally (in generateConnectionInfoFromCliArgs) it works fine but for tests I think it would be better to continue using the test mongo client provided by the MdbIntegration.
} | ||
} | ||
|
||
export async function waitUntilSearchManagementServiceIsReady( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we using waitUntilSearchIsReady
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably you should take a look at mongodbHelpers.ts and see what can be reused and refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the same methods. I just renamed / refactored them to re-use parts of the logic.
import { type DbOperationArgs, MongoDBToolBase } from "../tools/mongodb/mongodbTool.js"; | ||
import type { ToolArgs } from "../tools/tool.js"; | ||
|
||
export abstract class MongoDBToolWithSearchErrorHandler extends MongoDBToolBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we want this. In #626 we are using the MongoDBToolBase, and it would be best to have all errors centralised in one single place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just now stumbled upon it while I was going through your PR. Certainly that's more preferable.
Proposed changes
Adds support for dropping vector search indexes in drop-index tool. The functionality is behind a feature flag.
Checklist