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

mongodb-js / mongodb-mcp-server / 16076959781

04 Jul 2025 03:28PM UTC coverage: 74.187% (-0.1%) from 74.286%
16076959781

Pull #339

github

web-flow
Merge 905959cd5 into d7d4aa9ae
Pull Request #339: chore: reinstate telemetry/docker change after revert MCP-49

233 of 394 branches covered (59.14%)

Branch coverage included in aggregate %.

20 of 24 new or added lines in 1 file covered. (83.33%)

816 of 1020 relevant lines covered (80.0%)

59.0 hits per line

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

40.0
/src/tools/atlas/read/listAlerts.ts
1
import { z } from "zod";
2
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
import { AtlasToolBase } from "../atlasTool.js";
4
import { ToolArgs, OperationType } from "../../tool.js";
5

6
export class ListAlertsTool extends AtlasToolBase {
7
    protected name = "atlas-list-alerts";
33✔
8
    protected description = "List MongoDB Atlas alerts";
33✔
9
    protected operationType: OperationType = "read";
33✔
10
    protected argsShape = {
33✔
11
        projectId: z.string().describe("Atlas project ID to list alerts for"),
12
    };
13

14
    protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
15
        const data = await this.session.apiClient.listAlerts({
1✔
16
            params: {
17
                path: {
18
                    groupId: projectId,
19
                },
20
            },
21
        });
22

23
        if (!data?.results?.length) {
1✔
24
            return { content: [{ type: "text", text: "No alerts found in your MongoDB Atlas project." }] };
1✔
25
        }
26

27
        // Format alerts as a table
28
        const output =
29
            `Alert ID | Status | Created | Updated | Type | Comment
×
30
----------|---------|----------|----------|------|--------
31
` +
32
            data.results
33
                .map((alert) => {
34
                    const created = alert.created ? new Date(alert.created).toLocaleString() : "N/A";
×
35
                    const updated = alert.updated ? new Date(alert.updated).toLocaleString() : "N/A";
×
36
                    const comment = alert.acknowledgementComment ?? "N/A";
×
37
                    return `${alert.id} | ${alert.status} | ${created} | ${updated} | ${alert.eventTypeName} | ${comment}`;
×
38
                })
39
                .join("\n");
40

41
        return {
×
42
            content: [{ type: "text", text: output }],
43
        };
44
    }
45
}
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