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

mongodb-js / mongodb-mcp-server / 15063490200

16 May 2025 07:51AM UTC coverage: 73.774%. First build
15063490200

Pull #258

github

web-flow
Merge 047c85483 into 298adf4a5
Pull Request #258: feat: listSearchIndexes now lists index status info

209 of 368 branches covered (56.79%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

829 of 1039 relevant lines covered (79.79%)

54.59 hits per line

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

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

5
export class UpdateSearchIndexTool extends MongoDBToolBase {
6
    protected name = "update-search-index";
34✔
7
    protected description = "Updates an Atlas Search index for a collection";
34✔
8
    protected argsShape = {
34✔
9
        ...DbOperationArgs,
10
        name: SearchIndexArgs.name,
11
        analyzer: SearchIndexArgs.analyzer,
12
        mappings: SearchIndexArgs.mappings,
13
    };
14

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

17
    protected async execute({
18
        database,
19
        collection,
20
        name,
21
        analyzer,
22
        mappings,
23
    }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
24
        const provider = await this.ensureConnected();
×
25
        // @ts-expect-error: Interface expects a SearchIndexDefinition. However,
26
        // passing analyzer/mappings at the root for the definition is necessary for the call to succeed.
27
        await provider.updateSearchIndex(database, collection, name, {
×
28
            analyzer,
29
            mappings,
30
        });
31

32
        return {
×
33
            content: [
34
                {
35
                    text: `Successfully updated search 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