Skip to content

feat: Alerts Listing #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

feat: Alerts Listing #229

wants to merge 2 commits into from

Conversation

wtrocki
Copy link
Collaborator

@wtrocki wtrocki commented May 12, 2025

Add MongoDB Atlas Alerts List Tool

This PR adds a new tool to list alerts from MongoDB Atlas projects. The tool provides a tabular view of alerts with their status, creation time, and other relevant details.

Changes

  • Added ListAlertsTool class to handle listing alerts from Atlas projects
  • Added listAlerts method to the Atlas API client
  • Added OpenAPI type definitions for the alerts endpoint
  • Added integration tests for the new tool
  • Added the tool to the list of available Atlas tools

Testing

The changes include integration tests that verify:

  • Tool metadata and schema validation
  • Table formatting of alert results
  • Proper error handling for projects with no alerts

Example Usage

// List alerts for a project
await mcpClient.callTool({
    name: "atlas-list-alerts",
    arguments: { projectId: "your-project-id" }
});

The tool returns alerts in a table format with the following columns:

  • Alert ID
  • Status (OPEN/CLOSED/CANCELLED)
  • Created (timestamp)
  • Updated (timestamp)
  • Type (event type name)
  • Summary

API Reference

The tool uses the MongoDB Atlas API endpoint:
https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/alerts

Docs:
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Access-Tracking/operation/listAccessLogsByHostname

Related Issues

#216

Checklist

  • Added new tool implementation
  • Added API client method
  • Added integration tests
  • Updated tool registry
  • Verified error handling
  • Followed existing code patterns

Tests

Test Suites: 6 skipped, 26 passed, 26 of 32 total
Tests: 26 skipped, 284 passed, 310 total
Snapshots: 0 total
Time: 12.155 s
Ran all test suites.

@Copilot Copilot AI review requested due to automatic review settings May 12, 2025 09:30
@wtrocki wtrocki requested a review from a team as a code owner May 12, 2025 09:30
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements the MongoDB Atlas Alerts List Tool to list and display alerts in a tabular format. Key changes include:

  • Addition of the ListAlertsTool class with table formatting of alerts.
  • Integration tests verifying tool metadata, table structure, and error handling when no alerts exist.
  • Updates to the Atlas tool registry and API client to support the new alerts endpoint.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/integration/tools/atlas/alerts.test.ts Added integration tests for alerts listing and error handling.
src/tools/atlas/tools.ts Updated tool registry to include ListAlertsTool.
src/tools/atlas/read/listAlerts.ts Implemented the alerts listing tool with table output formatting.
src/common/atlas/apiClient.ts Added the listAlerts method to the API client for fetching alerts.

@wtrocki wtrocki marked this pull request as draft May 12, 2025 09:34
@wtrocki
Copy link
Collaborator Author

wtrocki commented May 12, 2025

Note for reviewers: I'm intentionally testing OpenSource contribution from fork. Can create PR directly if that makes any difference.

@wtrocki wtrocki closed this May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant