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

mongodb-js / mongodb-mcp-server / 17657973871

11 Sep 2025 09:37PM UTC coverage: 81.59% (+0.4%) from 81.188%
17657973871

Pull #524

github

web-flow
Merge 7617674d0 into d6b84c7bd
Pull Request #524: chore: update smithery dockerfile to be closer to the official one

962 of 1279 branches covered (75.22%)

Branch coverage included in aggregate %.

4866 of 5864 relevant lines covered (82.98%)

46.3 hits per line

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

66.67
/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";
2✔
3
import { AtlasToolBase } from "../atlasTool.js";
2✔
4
import { AtlasArgs } from "../../args.js";
2✔
5

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

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

18
    protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
2✔
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

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

45
        return {
×
46
            content: formatUntrustedData(`Found ${data.results.length} alerts in project ${projectId}`, output),
×
47
        };
×
48
    }
1✔
49
}
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