Skip to content

Commit a8c6425

Browse files
authored
feat: atlas-get-performance-advisor tool: tweak language for slow queries (#645)
1 parent 1cf6f6d commit a8c6425

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/common/atlas/performanceAdvisorUtils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export type SlowQueryLog = components["schemas"]["PerformanceAdvisorSlowQuery"];
99

1010
export const DEFAULT_SLOW_QUERY_LOGS_LIMIT = 50;
1111

12+
export const SUGGESTED_INDEXES_COPY = `Note: The "Weight" field is measured in bytes, and represents the estimated number of bytes saved in disk reads per executed read query that would be saved by implementing an index suggestion. Please convert this to MB or GB for easier readability.`;
13+
export const SLOW_QUERY_LOGS_COPY = `Please notify the user that the MCP server tool limits slow query logs to the most recent ${DEFAULT_SLOW_QUERY_LOGS_LIMIT} slow query logs. This is a limitation of the MCP server tool only. More slow query logs and performance suggestions can be seen in the Atlas UI. Please give to the user the following docs about the performance advisor: https://www.mongodb.com/docs/atlas/performance-advisor/.`;
14+
1215
interface SuggestedIndexesResponse {
1316
content: components["schemas"]["PerformanceAdvisorResponse"];
1417
}

src/tools/atlas/read/getPerformanceAdvisor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
getSchemaAdvice,
1010
getSlowQueries,
1111
DEFAULT_SLOW_QUERY_LOGS_LIMIT,
12+
SUGGESTED_INDEXES_COPY,
13+
SLOW_QUERY_LOGS_COPY,
1214
} from "../../../common/atlas/performanceAdvisorUtils.js";
1315
import { AtlasArgs } from "../../args.js";
1416

@@ -98,11 +100,11 @@ export class GetPerformanceAdvisorTool extends AtlasToolBase {
98100
const performanceAdvisorData = [
99101
`## Suggested Indexes\n${
100102
hasSuggestedIndexes
101-
? `Note: The "Weight" field is measured in bytes, and represents the estimated number of bytes saved in disk reads per executed read query that would be saved by implementing an index suggestion. Please convert this to MB or GB for easier readability.\n${JSON.stringify(suggestedIndexesResult.value?.suggestedIndexes)}`
103+
? `${SUGGESTED_INDEXES_COPY}\n${JSON.stringify(suggestedIndexesResult.value?.suggestedIndexes)}`
102104
: "No suggested indexes found."
103105
}`,
104106
`## Drop Index Suggestions\n${hasDropIndexSuggestions ? JSON.stringify(dropIndexSuggestionsResult.value) : "No drop index suggestions found."}`,
105-
`## Slow Query Logs\n${hasSlowQueryLogs ? JSON.stringify(slowQueryLogsResult.value?.slowQueryLogs) : "No slow query logs found."}`,
107+
`## Slow Query Logs\n${hasSlowQueryLogs ? `${SLOW_QUERY_LOGS_COPY}\n${JSON.stringify(slowQueryLogsResult.value?.slowQueryLogs)}` : "No slow query logs found."}`,
106108
`## Schema Suggestions\n${hasSchemaSuggestions ? JSON.stringify(schemaSuggestionsResult.value?.recommendations) : "No schema suggestions found."}`,
107109
];
108110

0 commit comments

Comments
 (0)