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

mongodb-js / mongodb-mcp-server / 16292877152

15 Jul 2025 12:10PM UTC coverage: 77.385% (+2.1%) from 75.27%
16292877152

push

github

web-flow
chore(tests): switch to vitest (#363)

498 of 687 branches covered (72.49%)

Branch coverage included in aggregate %.

0 of 27 new or added lines in 2 files covered. (0.0%)

293 existing lines in 26 files now uncovered.

2828 of 3611 relevant lines covered (78.32%)

28.46 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
UNCOV
28
        const output =
×
29
            `Alert ID | Status | Created | Updated | Type | Comment
×
30
----------|---------|----------|----------|------|--------
31
` +
UNCOV
32
            data.results
×
UNCOV
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}`;
×
UNCOV
38
                })
×
UNCOV
39
                .join("\n");
×
40

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