Skip to content

Commit bea2a6f

Browse files
committed
fix accuracy tests
1 parent 9c623e1 commit bea2a6f

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

tests/accuracy/getPerformanceAdvisor.test.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1+
import { formatUntrustedData } from "../../src/tools/tool.js";
12
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
23
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
34

5+
const projectId = "68f600519f16226591d054c0";
6+
47
// Shared mock tool implementations
58
const mockedTools = {
69
"atlas-list-projects": (): CallToolResult => {
710
return {
8-
content: [
9-
{
10-
type: "text",
11-
text: "Found 1 project\n\n# | Name | ID\n---|------|----\n1 | mflix | mflix",
12-
},
13-
],
11+
content: formatUntrustedData(
12+
"Found 1 projects",
13+
JSON.stringify([
14+
{
15+
name: "mflix",
16+
id: projectId,
17+
orgId: "68f600589f16226591d054c1",
18+
orgName: "MyOrg",
19+
created: "N/A",
20+
},
21+
])
22+
),
1423
};
1524
},
1625
"atlas-list-clusters": (): CallToolResult => {
@@ -44,7 +53,7 @@ const listProjectsAndClustersToolCalls = [
4453
{
4554
toolName: "atlas-list-clusters",
4655
parameters: {
47-
projectId: "mflix",
56+
projectId,
4857
},
4958
optional: true,
5059
},
@@ -59,7 +68,7 @@ describeAccuracyTests([
5968
{
6069
toolName: "atlas-get-performance-advisor",
6170
parameters: {
62-
projectId: "mflix",
71+
projectId,
6372
clusterName: "mflix-cluster",
6473
operations: ["suggestedIndexes"],
6574
},
@@ -75,7 +84,7 @@ describeAccuracyTests([
7584
{
7685
toolName: "atlas-get-performance-advisor",
7786
parameters: {
78-
projectId: "mflix",
87+
projectId,
7988
clusterName: "mflix-cluster",
8089
operations: ["dropIndexSuggestions"],
8190
},
@@ -91,7 +100,7 @@ describeAccuracyTests([
91100
{
92101
toolName: "atlas-get-performance-advisor",
93102
parameters: {
94-
projectId: "mflix",
103+
projectId,
95104
clusterName: "mflix-cluster",
96105
operations: ["slowQueryLogs"],
97106
namespaces: ["mflix.movies", "mflix.shows"],
@@ -109,7 +118,7 @@ describeAccuracyTests([
109118
{
110119
toolName: "atlas-get-performance-advisor",
111120
parameters: {
112-
projectId: "mflix",
121+
projectId,
113122
clusterName: "mflix-cluster",
114123
operations: ["schemaSuggestions"],
115124
},
@@ -125,7 +134,7 @@ describeAccuracyTests([
125134
{
126135
toolName: "atlas-get-performance-advisor",
127136
parameters: {
128-
projectId: "mflix",
137+
projectId,
129138
clusterName: "mflix-cluster",
130139
},
131140
},

0 commit comments

Comments
 (0)