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

mongodb-js / mongodb-mcp-server / 18911327516

29 Oct 2025 02:27PM UTC coverage: 80.317% (+0.09%) from 80.227%
18911327516

Pull #653

github

web-flow
Merge c9247e7ad into 01f799ccb
Pull Request #653: chore: update atlas tools output to json - MCP-264

1349 of 1815 branches covered (74.33%)

Branch coverage included in aggregate %.

37 of 60 new or added lines in 6 files covered. (61.67%)

2 existing lines in 2 files now uncovered.

6343 of 7762 relevant lines covered (81.72%)

71.36 hits per line

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

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

6
export const ListAlertsArgs = {
3✔
7
    projectId: AtlasArgs.projectId().describe("Atlas project ID to list alerts for"),
3✔
8
};
3✔
9

10
export class ListAlertsTool extends AtlasToolBase {
3✔
11
    public name = "atlas-list-alerts";
84✔
12
    protected description = "List MongoDB Atlas alerts";
84✔
13
    public operationType: OperationType = "read";
84✔
14
    protected argsShape = {
84✔
15
        ...ListAlertsArgs,
84✔
16
    };
84✔
17

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

27
        if (!data?.results?.length) {
1✔
28
            return { content: [{ type: "text", text: "No alerts found in your MongoDB Atlas project." }] };
1✔
29
        }
1!
30

NEW
31
        const alerts = data.results.map((alert) => ({
×
NEW
32
            id: alert.id,
×
NEW
33
            status: alert.status,
×
NEW
34
            created: alert.created ? new Date(alert.created).toISOString() : "N/A",
×
NEW
35
            updated: alert.updated ? new Date(alert.updated).toISOString() : "N/A",
×
NEW
36
            eventTypeName: alert.eventTypeName,
×
NEW
37
            acknowledgementComment: alert.acknowledgementComment ?? "N/A",
×
NEW
38
        }));
×
39

UNCOV
40
        return {
×
NEW
41
            content: formatUntrustedData(
×
NEW
42
                `Found ${data.results.length} alerts in project ${projectId}`,
×
NEW
43
                JSON.stringify(alerts)
×
NEW
44
            ),
×
45
        };
×
46
    }
1✔
47
}
3✔
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