-
Notifications
You must be signed in to change notification settings - Fork 126
feat: Atlas list performance advisor tool #609
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
base: main
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
export async function deleteCluster( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved deleteCluster
and waitCluster
to atlasHelpers.ts
There was a problem hiding this 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 adds a new Atlas performance advisor tool (atlas-get-performance-advisor
) to the MCP server, enabling users to retrieve MongoDB Atlas performance recommendations including suggested indexes, drop index suggestions, slow query logs, and schema suggestions.
- Implements a comprehensive performance advisor tool that supports multiple operation types
- Adds supporting utilities for Atlas performance advisor API integration
- Includes extensive integration and accuracy test coverage
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/tools/atlas/read/getPerformanceAdvisor.ts |
Main implementation of the performance advisor tool with support for multiple operation types |
src/common/atlas/performanceAdvisorUtils.ts |
Utility functions for interacting with Atlas performance advisor APIs |
src/common/atlas/cluster.ts |
Enhanced cluster functionality to extract process IDs from connection strings |
src/common/atlas/apiClient.ts |
Added API client methods for performance advisor endpoints |
tests/integration/tools/atlas/performanceAdvisor.test.ts |
Integration tests for the performance advisor tool |
tests/accuracy/listPerformanceAdvisor.test.ts |
Accuracy tests to ensure correct tool usage by LLMs |
|
||
export class GetPerformanceAdvisorTool extends AtlasToolBase { | ||
public name = "atlas-get-performance-advisor"; | ||
protected description = `Get MongoDB Atlas performance advisor recommendations, which includes the operations: suggested indexes, drop index suggestions, schema suggestions, and a sample of the most recent (max ${DEFAULT_SLOW_QUERY_LOGS_LIMIT}) slow query logs`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tool name should follow the naming convention of describing an action. Consider changing 'atlas-get-performance-advisor' to 'atlas-list-performance-advisor' to be consistent with other listing tools.
Copilot generated this review using guidance from repository custom instructions.
dropIndexSuggestionsResult.value.hiddenIndexes.length > 0 && | ||
dropIndexSuggestionsResult.value.redundantIndexes.length > 0 && | ||
dropIndexSuggestionsResult.value.unusedIndexes.length > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for hasDropIndexSuggestions
is incorrect. It requires ALL three arrays (hidden, redundant, and unused indexes) to have data, when it should return true if ANY of them have data. Change the &&
operators on lines 85-87 to ||
.
dropIndexSuggestionsResult.value.hiddenIndexes.length > 0 && | |
dropIndexSuggestionsResult.value.redundantIndexes.length > 0 && | |
dropIndexSuggestionsResult.value.unusedIndexes.length > 0; | |
( | |
dropIndexSuggestionsResult.value.hiddenIndexes.length > 0 || | |
dropIndexSuggestionsResult.value.redundantIndexes.length > 0 || | |
dropIndexSuggestionsResult.value.unusedIndexes.length > 0 | |
); |
Copilot uses AI. Check for mistakes.
}, | ||
}, | ||
{ | ||
toolName: "atlas-list-performance-advisor", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent tool name in accuracy tests. The actual tool is named 'atlas-get-performance-advisor' but the test expects 'atlas-list-performance-advisor'. This mismatch will cause test failures.
Copilot uses AI. Check for mistakes.
Proposed changes
Checklist