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

mongodb-js / mongodb-mcp-server / 14618487127

23 Apr 2025 12:45PM UTC coverage: 78.42% (+1.7%) from 76.675%
14618487127

Pull #91

github

nirinchev
PR comments
Pull Request #91: chore: add tests for metadata actions

90 of 161 branches covered (55.9%)

Branch coverage included in aggregate %.

22 of 23 new or added lines in 4 files covered. (95.65%)

30 existing lines in 12 files now uncovered.

575 of 687 relevant lines covered (83.7%)

30.41 hits per line

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

84.62
/src/tools/atlas/listOrgs.ts
1
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
import { AtlasToolBase } from "./atlasTool.js";
18✔
3
import { OperationType } from "../tool.js";
4

5
export class ListOrganizationsTool extends AtlasToolBase {
18✔
6
    protected name = "atlas-list-orgs";
18✔
7
    protected description = "List MongoDB Atlas organizations";
18✔
8
    protected operationType: OperationType = "read";
18✔
9
    protected argsShape = {};
18✔
10

11
    protected async execute(): Promise<CallToolResult> {
12
        this.session.ensureAuthenticated();
1✔
13

14
        const data = await this.session.apiClient.listOrganizations();
1!
UNCOV
15

×
16
        if (!data?.results?.length) {
17
            throw new Error("No projects found in your MongoDB Atlas account.");
18
        }
19

20
        // Format projects as a table
1✔
21
        const output =
22
            `Organization Name | Organization ID
23
----------------| ----------------
24
` +
25
            data.results
1✔
26
                .map((org) => {
27
                    return `${org.name} | ${org.id}`;
28
                })
1✔
29
                .join("\n");
30
        return {
31
            content: [{ type: "text", text: output }],
32
        };
33
    }
34
}
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