Skip to content

Conversation

@nirinchev
Copy link
Collaborator

Proposed changes

This adds support for creating atlas search indexes. Dropping and listing is already supported, so needed no changes.

@nirinchev nirinchev requested a review from a team as a code owner October 27, 2025 15:11
@nirinchev nirinchev requested a review from Copilot October 27, 2025 16:03
Base automatically changed from ni/feature-flags to main October 27, 2025 16:03
Copy link
Contributor

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 support for creating Atlas Search (lexical) indexes through the MCP server. The changes enable users to create Atlas Search indexes with both dynamic and explicit field mappings, complementing the existing support for listing and dropping search indexes.

Key changes:

  • Added Atlas Search index creation support to create-index tool with comprehensive schema validation
  • Enhanced testing to differentiate between search and vector search indexes
  • Added accuracy tests for various Atlas Search index creation scenarios

Reviewed Changes

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

Show a summary per file
File Description
src/tools/mongodb/create/createIndex.ts Adds atlasSearchIndexDefinition schema and implements search index creation logic
tests/integration/tools/mongodb/create/createIndex.test.ts Adds comprehensive integration tests for Atlas Search index creation scenarios
tests/integration/tools/mongodb/delete/dropIndex.test.ts Refactors tests to handle both search and vector search indexes separately
tests/accuracy/createIndex.test.ts Adds accuracy test cases for Atlas Search index creation with various configurations
tests/accuracy/sdk/accuracyTestingClient.ts Removes deprecated --connectionString flag from CLI arguments
README.md Updates documentation to remove deprecated --connectionString flag
Comments suppressed due to low confidence (1)

tests/integration/tools/mongodb/create/createIndex.test.ts:1

  • The index names are being evaluated at test definition time rather than test execution time. If getSearchIndexName() and getVectorIndexName() depend on beforeEach setup, these calls will execute before the setup runs, potentially returning undefined or stale values. Wrap these in functions: { description: "search", indexName: () => getSearchIndexName() } and update the test to call the function.
import { describeWithMongoDB, validateAutoConnectBehavior, waitUntilSearchIsReady } from "../mongodbHelpers.js";

@coveralls
Copy link
Collaborator

coveralls commented Oct 27, 2025

Pull Request Test Coverage Report for Build 18872159746

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 140 of 140 (100.0%) changed or added relevant lines in 1 file are covered.
  • 57 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.3%) to 80.38%

Files with Coverage Reduction New Missed Lines %
src/tools/mongodb/read/aggregate.ts 26 88.72%
src/common/search/vectorSearchEmbeddingsManager.ts 31 81.79%
Totals Coverage Status
Change from base Build 18847594160: 0.3%
Covered Lines: 6435
Relevant Lines: 7861

💛 - Coveralls

import { quantizationEnum, similarityEnum } from "../../../common/search/vectorSearchEmbeddingsManager.js";

export class CreateIndexTool extends MongoDBToolBase {
private vectorSearchIndexDefinition = z.object({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is best viewed with the "Hide whitespace" option - it's just prettier reformatting the indents.

});

const args = [MCP_SERVER_CLI_SCRIPT, "--connectionString", mdbConnectionString, ...additionalArgs];
const args = [MCP_SERVER_CLI_SCRIPT, mdbConnectionString, ...additionalArgs];
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

--connectionString is deprecated so using the positional argument.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants