Skip to content

Commit ea41c0c

Browse files
committed
Add args to slow query test
1 parent 817b961 commit ea41c0c

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/tools/atlas/read/listPerformanceAdvisor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class ListPerformanceAdvisorTool extends AtlasToolBase {
4141
clusterName: z.string().describe("Atlas cluster name to list performance advisor recommendations"),
4242
operations: z
4343
.array(PerformanceAdvisorOperationType)
44+
.default(PerformanceAdvisorOperationType.options)
4445
.describe("Operations to list performance advisor recommendations"),
4546
since: z.date().describe("Date to list slow query logs since").optional(),
4647
namespaces: z

tests/accuracy/listPerformanceAdvisor.test.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { PerformanceAdvisorOperation } from "../../src/common/atlas/performanceAdvisorUtils.js";
21
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
32
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
43

@@ -56,7 +55,7 @@ describeAccuracyTests([
5655
parameters: {
5756
projectId: "mflix",
5857
clusterName: "mflix-cluster",
59-
operations: [PerformanceAdvisorOperation.SUGGESTED_INDEXES],
58+
operations: ["suggestedIndexes"],
6059
},
6160
},
6261
],
@@ -81,15 +80,15 @@ describeAccuracyTests([
8180
parameters: {
8281
projectId: "mflix",
8382
clusterName: "mflix-cluster",
84-
operations: [PerformanceAdvisorOperation.DROP_INDEX_SUGGESTIONS],
83+
operations: ["dropIndexSuggestions"],
8584
},
8685
},
8786
],
8887
mockedTools,
8988
},
9089
// Test for Slow Query Logs operation
9190
{
92-
prompt: "Show me the slow query logs for the 'mflix' project and 'mflix-cluster' cluster?",
91+
prompt: "Show me the slow query logs for the 'mflix' project and 'mflix-cluster' cluster for the namespaces 'mflix.movies' and 'mflix.shows' since January 1st, 2025.",
9392
expectedToolCalls: [
9493
{
9594
toolName: "atlas-list-projects",
@@ -106,7 +105,9 @@ describeAccuracyTests([
106105
parameters: {
107106
projectId: "mflix",
108107
clusterName: "mflix-cluster",
109-
operations: [PerformanceAdvisorOperation.SLOW_QUERY_LOGS],
108+
operations: ["slowQueryLogs"],
109+
namespaces: ["mflix.movies", "mflix.shows"],
110+
since: "2025-01-01T00:00:00Z",
110111
},
111112
},
112113
],
@@ -131,7 +132,7 @@ describeAccuracyTests([
131132
parameters: {
132133
projectId: "mflix",
133134
clusterName: "mflix-cluster",
134-
operations: [PerformanceAdvisorOperation.SCHEMA_SUGGESTIONS],
135+
operations: ["schemaSuggestions"],
135136
},
136137
},
137138
],
@@ -156,12 +157,6 @@ describeAccuracyTests([
156157
parameters: {
157158
projectId: "mflix",
158159
clusterName: "mflix-cluster",
159-
operations: [
160-
PerformanceAdvisorOperation.SUGGESTED_INDEXES,
161-
PerformanceAdvisorOperation.DROP_INDEX_SUGGESTIONS,
162-
PerformanceAdvisorOperation.SLOW_QUERY_LOGS,
163-
PerformanceAdvisorOperation.SCHEMA_SUGGESTIONS,
164-
],
165160
},
166161
},
167162
],

0 commit comments

Comments
 (0)