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

mongodb-js / mongodb-mcp-server / 16347477296

17 Jul 2025 02:10PM UTC coverage: 77.304% (-0.09%) from 77.39%
16347477296

Pull #378

github

web-flow
Merge 2f2bcf319 into fd3f2a4fd
Pull Request #378: chore: specify the correct minimum node requirements

496 of 685 branches covered (72.41%)

Branch coverage included in aggregate %.

2825 of 3611 relevant lines covered (78.23%)

28.48 hits per line

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

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

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

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

23
        if (!data?.results?.length) {
1✔
24
            return { content: [{ type: "text", text: "No alerts found in your MongoDB Atlas project." }] };
1✔
25
        }
1!
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
    }
1✔
45
}
2✔
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