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

mongodb-js / mongodb-mcp-server / 18717167438

22 Oct 2025 01:06PM UTC coverage: 79.906% (-2.0%) from 81.905%
18717167438

push

github

web-flow
chore: When querying with vectorSearch use the generated embeddings MCP-245 (#662)

1341 of 1809 branches covered (74.13%)

Branch coverage included in aggregate %.

128 of 193 new or added lines in 4 files covered. (66.32%)

198 existing lines in 6 files now uncovered.

6143 of 7557 relevant lines covered (81.29%)

73.09 hits per line

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

68.66
/src/tools/atlas/create/createProject.ts
1
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
import { type OperationType, type ToolArgs } from "../../tool.js";
3
import { AtlasToolBase } from "../atlasTool.js";
3✔
4
import type { Group } from "../../../common/atlas/openapi.js";
5
import { AtlasArgs } from "../../args.js";
3✔
6

7
export class CreateProjectTool extends AtlasToolBase {
3✔
8
    public name = "atlas-create-project";
83✔
9
    protected description = "Create a MongoDB Atlas project";
83✔
10
    public operationType: OperationType = "create";
83✔
11
    protected argsShape = {
83✔
12
        projectName: AtlasArgs.projectName().optional().describe("Name for the new project"),
83✔
13
        organizationId: AtlasArgs.organizationId().optional().describe("Organization ID for the new project"),
83✔
14
    };
83✔
15

16
    protected async execute({ projectName, organizationId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
3✔
17
        let assumedOrg = false;
2✔
18

19
        if (!projectName) {
2!
UNCOV
20
            projectName = "Atlas Project";
×
UNCOV
21
        }
×
22

23
        if (!organizationId) {
2✔
24
            try {
1✔
25
                const organizations = await this.session.apiClient.listOrganizations();
1✔
26
                if (!organizations?.results?.length) {
1!
UNCOV
27
                    throw new Error(
×
UNCOV
28
                        "No organizations were found in your MongoDB Atlas account. Please create an organization first."
×
UNCOV
29
                    );
×
UNCOV
30
                }
×
31
                const firstOrg = organizations.results[0];
1✔
32
                if (!firstOrg?.id) {
1!
33
                    throw new Error(
×
34
                        "The first organization found does not have an ID. Please check your Atlas account."
×
UNCOV
35
                    );
×
UNCOV
36
                }
×
37
                organizationId = firstOrg.id;
1✔
38
                assumedOrg = true;
1✔
39
            } catch {
1!
40
                throw new Error(
×
UNCOV
41
                    "Could not search for organizations in your MongoDB Atlas account, please provide an organization ID or create one first."
×
UNCOV
42
                );
×
UNCOV
43
            }
×
44
        }
1✔
45

46
        const input = {
2✔
47
            name: projectName,
2✔
48
            orgId: organizationId,
2✔
49
        } as Group;
2✔
50

51
        const group = await this.session.apiClient.createProject({
2✔
52
            body: input,
2✔
53
        });
2✔
54

55
        if (!group?.id) {
2!
UNCOV
56
            throw new Error("Failed to create project");
×
UNCOV
57
        }
×
58

59
        return {
2✔
60
            content: [
2✔
61
                {
2✔
62
                    type: "text",
2✔
63
                    text: `Project "${projectName}" created successfully${assumedOrg ? ` (using organizationId ${organizationId}).` : ""}.`,
2✔
64
                },
2✔
65
            ],
2✔
66
        };
2✔
67
    }
2✔
68
}
3✔
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

© 2026 Coveralls, Inc