Skip to content

Conversation

kylelai1
Copy link
Collaborator

@kylelai1 kylelai1 commented Oct 3, 2025

}
}

export async function deleteCluster(
Copy link
Collaborator Author

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

@kylelai1 kylelai1 changed the title [WIP] feat: Atlas list performance advisor tool feat: Atlas list performance advisor tool Oct 3, 2025
@kylelai1 kylelai1 marked this pull request as ready for review October 6, 2025 04:28
@kylelai1 kylelai1 requested a review from a team as a code owner October 6, 2025 04:28
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 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`;
Copy link
Preview

Copilot AI Oct 6, 2025

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.

Comment on lines 85 to 87
dropIndexSuggestionsResult.value.hiddenIndexes.length > 0 &&
dropIndexSuggestionsResult.value.redundantIndexes.length > 0 &&
dropIndexSuggestionsResult.value.unusedIndexes.length > 0;
Copy link
Preview

Copilot AI Oct 6, 2025

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 ||.

Suggested change
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",
Copy link
Preview

Copilot AI Oct 6, 2025

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.

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