atlas-list-alerts
Retrieve and display active alerts for a specific MongoDB Atlas project to monitor system health and performance issues.
Instructions
List MongoDB Atlas alerts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Atlas project ID to list alerts for |
Implementation Reference
- src/tools/atlas/read/listAlerts.ts:18-46 (handler)The handler function that fetches alerts from the MongoDB Atlas API for the specified project, processes the data, and formats the response.protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> { const data = await this.session.apiClient.listAlerts({ params: { path: { groupId: projectId, }, }, }); if (!data?.results?.length) { return { content: [{ type: "text", text: "No alerts found in your MongoDB Atlas project." }] }; } const alerts = data.results.map((alert) => ({ id: alert.id, status: alert.status, created: alert.created ? new Date(alert.created).toISOString() : "N/A", updated: alert.updated ? new Date(alert.updated).toISOString() : "N/A", eventTypeName: alert.eventTypeName, acknowledgementComment: alert.acknowledgementComment ?? "N/A", })); return { content: formatUntrustedData( `Found ${data.results.length} alerts in project ${projectId}`, JSON.stringify(alerts) ), }; }
- Defines the input schema for the tool, specifying the required projectId argument.export const ListAlertsArgs = { projectId: AtlasArgs.projectId().describe("Atlas project ID to list alerts for"), };
- src/tools/atlas/read/listAlerts.ts:10-17 (registration)Registers the tool by defining the class with name, description, operation type, and argument shape.export class ListAlertsTool extends AtlasToolBase { public name = "atlas-list-alerts"; protected description = "List MongoDB Atlas alerts"; static operationType: OperationType = "read"; protected argsShape = { ...ListAlertsArgs, };