• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 15053059013

15 May 2025 07:00PM UTC coverage: 73.681%. First build
15053059013

Pull #255

github

web-flow
Merge e74e7d20f into 298adf4a5
Pull Request #255: Add PlaygroundClient client. Add tests for RunPipeline tool.

213 of 373 branches covered (57.1%)

Branch coverage included in aggregate %.

13 of 26 new or added lines in 2 files covered. (50.0%)

834 of 1048 relevant lines covered (79.58%)

54.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/src/tools/mongodb/update/updateVectorIndex.ts
1
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
import { buildVectorFields, DbOperationArgs, MongoDBToolBase, VectorIndexArgs } from "../mongodbTool.js";
3
import { OperationType, ToolArgs } from "../../tool.js";
4

5
export class UpdateVectorIndexTool extends MongoDBToolBase {
6
    protected name = "update-vector-index";
34✔
7
    protected description = "Updates an Atlas Search vector for a collection";
34✔
8
    protected argsShape = {
34✔
9
        ...DbOperationArgs,
10
        name: VectorIndexArgs.name,
11
        vectorDefinition: VectorIndexArgs.vectorDefinition,
12
        filterFields: VectorIndexArgs.filterFields,
13
    };
14

15
    protected operationType: OperationType = "create";
34✔
16

17
    protected async execute({
18
        database,
19
        collection,
20
        name,
21
        vectorDefinition,
22
        filterFields,
23
    }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
24
        const provider = await this.ensureConnected();
×
25

26
        // @ts-expect-error: Interface expects a SearchIndexDefinition {definition: {fields}}. However,
27
        // passing fields at the root level is necessary for the call to succeed.
28
        await provider.updateSearchIndex(database, collection, name, {
×
29
            fields: buildVectorFields(vectorDefinition, filterFields),
30
        });
31

32
        return {
×
33
            content: [
34
                {
35
                    text: `Successfully updated vector index "${name}" on collection "${collection}" in database "${database}"`,
36
                    type: "text",
37
                },
38
            ],
39
        };
40
    }
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc