• 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

62.5
/src/tools/mongodb/create/createVectorIndex.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
const VECTOR_INDEX_TYPE = "vectorSearch";
37✔
6
export class CreateVectorIndexTool extends MongoDBToolBase {
7
    protected name = "create-vector-index";
34✔
8
    protected description = "Create an Atlas Vector Search Index for a collection.";
34✔
9
    protected argsShape = {
34✔
10
        ...DbOperationArgs,
11
        name: VectorIndexArgs.name,
12
        vectorDefinition: VectorIndexArgs.vectorDefinition,
13
        filterFields: VectorIndexArgs.filterFields,
14
    };
15

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

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

27
        const indexes = await provider.createSearchIndexes(database, collection, [
×
28
            {
29
                name,
30
                type: VECTOR_INDEX_TYPE,
31
                definition: { fields: buildVectorFields(vectorDefinition, filterFields) },
32
            },
33
        ]);
34

35
        return {
×
36
            content: [
37
                {
38
                    text: `Created the vector index ${indexes[0]} on collection "${collection}" in database "${database}"`,
39
                    type: "text",
40
                },
41
            ],
42
        };
43
    }
44
}
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