• 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

82.35
/src/tools/atlas/inspectCluster.ts
1
import { z } from "zod";
18✔
2
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
import { AtlasToolBase } from "./atlasTool.js";
18✔
4
import { ToolArgs, OperationType } from "../tool.js";
5
import { ClusterDescription20240805 } from "../../common/atlas/openapi.js";
6

7
export class InspectClusterTool extends AtlasToolBase {
18✔
8
    protected name = "atlas-inspect-cluster";
18✔
9
    protected description = "Inspect MongoDB Atlas cluster";
18✔
10
    protected operationType: OperationType = "read";
18✔
11
    protected argsShape = {
18✔
12
        projectId: z.string().describe("Atlas project ID"),
13
        clusterName: z.string().describe("Atlas cluster name"),
14
    };
15

16
    protected async execute({ projectId, clusterName }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
17
        this.session.ensureAuthenticated();
1✔
18

19
        const cluster = await this.session.apiClient.getCluster({
20
            params: {
21
                path: {
22
                    groupId: projectId,
23
                    clusterName,
24
                },
25
            },
26
        });
1✔
27

28
        return this.formatOutput(cluster);
29
    }
30

1!
UNCOV
31
    private formatOutput(cluster?: ClusterDescription20240805): CallToolResult {
×
32
        if (!cluster) {
33
            throw new Error("Cluster not found");
34
        }
1✔
35

36
        return {
37
            content: [
38
                {
39
                    type: "text",
40
                    text: `Cluster Name | State | MongoDB Version | Connection String
3!
41
----------------|----------------|----------------|----------------|----------------
42
${cluster.name} | ${cluster.stateName} | ${cluster.mongoDBVersion || "N/A"} | ${cluster.connectionStrings?.standard || "N/A"}`,
43
                },
44
            ],
45
        };
46
    }
47
}
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