Skip to content

Conversation

kmruiz
Copy link
Collaborator

@kmruiz kmruiz commented Oct 6, 2025

Proposed changes

It detects if the cluster supports search indexes the same way we do in all other tooling: by catching the exception. In some old clusters it might still return an empty list for unsupported clusters, but we can't really know for sure.

Checklist

@kmruiz kmruiz changed the title feat(search): Add a new tool to list search and vector search indexes feat(search): Add a new tool to list search and vector search indexes MCP-235 Oct 6, 2025
Copy link
Contributor

github-actions bot commented Oct 6, 2025

📊 Accuracy Test Results

📈 Summary

Metric Value
Commit SHA 38efa179d6b674dc3dd6462bb18afcec825da2bf
Run ID 7839650b-f59d-4eb6-8c35-4215b4b87d10
Status done
Total Prompts Evaluated 61
Models Tested 1
Average Accuracy 95.1%
Responses with 0% Accuracy 2
Responses with 75% Accuracy 4
Responses with 100% Accuracy 55

📊 Baseline Comparison

Metric Value
Baseline Commit 071fc3bb8ded2e723562ef0a203a3adef60012f1
Baseline Run ID 164e8532-931b-4baf-b8e6-5dd0524cb6a1
Baseline Run Status done
Responses Improved 0
Responses Regressed 1

📎 Download Full HTML Report - Look for the accuracy-test-summary artifact for detailed results.

Report generated on: 10/6/2025, 1:52:38 PM

@coveralls
Copy link
Collaborator

coveralls commented Oct 6, 2025

Pull Request Test Coverage Report for Build 18284013540

Details

  • 50 of 59 (84.75%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 82.488%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/tools/mongodb/search/listSearchIndexes.ts 48 57 84.21%
Totals Coverage Status
Change from base Build 18276805864: -0.02%
Covered Lines: 5346
Relevant Lines: 6367

💛 - Coveralls

@kmruiz kmruiz marked this pull request as ready for review October 6, 2025 14:55
@kmruiz kmruiz requested a review from a team as a code owner October 6, 2025 14:55
@Copilot Copilot AI review requested due to automatic review settings October 6, 2025 14:55
Copy link
Contributor

@Copilot Copilot AI left a 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 adds a new MongoDB MCP tool called "list-search-indexes" that allows users to list search and vector search indexes for a specific collection. The tool detects Atlas Search support by catching exceptions and provides appropriate error messages for unsupported clusters.

Key changes:

  • New search indexes listing tool with comprehensive test coverage
  • Enhanced test infrastructure to support Atlas Local containers via Docker
  • Refactored shared utilities and improved test organization

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/tools/mongodb/search/listSearchIndexes.ts Core implementation of the new list-search-indexes tool
tests/integration/tools/mongodb/search/listSearchIndexes.test.ts Integration tests for the new tool with Atlas Local support
tests/integration/tools/mongodb/mongodbHelpers.ts Enhanced test helpers to support Docker containers and search clusters
tests/accuracy/listSearchIndexes.test.ts Accuracy tests for the new tool
src/tools/mongodb/tools.ts Registers the new tool in the MongoDB tools array
tests/integration/transports/stdio.test.ts Updates tool count expectation
tests/integration/helpers.ts Adds shared sleep utility function
tests/integration/tools/atlas/clusters.test.ts Uses shared sleep utility
package.json Adds testcontainers dependencies
.github/workflows/code-health.yml Adds Docker setup for CI
.github/workflows/code-health-fork.yml Adds Docker setup for fork CI

@kmruiz kmruiz requested a review from Copilot October 6, 2025 15:10
Copilot

This comment was marked as outdated.

It detects if the cluster supports search indexes the same way we
do in all other tooling: by catching the exception. In some old
clusters it might still return an empty list for unsupported
custers, but we can't really know for sure.

As we depend on mongot, we need to use the Atlas local
image, which is not supported by mongodb-runner. Instead,
we use testcontainers, that allows to run any docker image,
which is enough for our use case.

For now only run docker tests in Ubuntu
* macos-latest does not support nested virtualisation yet
* we don't have windows containers for atlas images
if: matrix.os == 'ubuntu-latest'
- uses: actions/checkout@v5
- uses: docker/setup-docker-action@v4
if: matrix.os == 'ubuntu-latest'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... why use this only on ubuntu runners?

latestDefinition: Document;
};

export class ListSearchIndexesTool extends MongoDBToolBase {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: Why is this a separate tool instead of bundling the response in the collection-indexes tool?

downloadOptions: MongoClusterOptions["downloadOptions"] | MongoSearchConfiguration
): boolean {
// on GHA, OSX does not support nested virtualisation and we don't release
// windows containers, so for now we can only run these tests in Linux.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm misunderstanding something here, but shouldn't docker on windows be able to run the linux images we publish?

}

function isTestContainersCluster(
cluster: MongoCluster | StartedTestContainer | undefined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we want to create a simple wrapper around MongoCluster and StartedTestContainer so that we don't have to do a bunch of checks throughout this file.

arguments: { database: "any", collection: "foo" },
});
const content = getResponseContent(response.content);
expect(content).toEqual("There are no search or vector search indexes in any.foo");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this check correct? I'd expect the content to contain the untrusted data wrapper.

Comment on lines +128 to +129
success = true;
break;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than set success to true and break, you can return.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants