Skip to content

Commit bb717ab

Browse files
feat(atlas-local): Accuracy tests for Atlas Local (#554)
1 parent e774083 commit bb717ab

File tree

3 files changed

+215
-0
lines changed

3 files changed

+215
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
2+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3+
4+
describeAccuracyTests([
5+
{
6+
prompt: "Setup a local MongoDB cluster named 'local-cluster'",
7+
expectedToolCalls: [
8+
{
9+
toolName: "atlas-local-create-deployment",
10+
parameters: {
11+
deploymentName: "local-cluster",
12+
},
13+
},
14+
],
15+
},
16+
{
17+
prompt: "Create a local MongoDB instance named 'local-cluster'",
18+
expectedToolCalls: [
19+
{
20+
toolName: "atlas-local-create-deployment",
21+
parameters: {
22+
deploymentName: "local-cluster",
23+
},
24+
},
25+
],
26+
},
27+
{
28+
prompt: "Setup a local MongoDB database named 'local-cluster'",
29+
expectedToolCalls: [
30+
{
31+
toolName: "atlas-local-create-deployment",
32+
parameters: {
33+
deploymentName: "local-cluster",
34+
},
35+
},
36+
],
37+
},
38+
{
39+
prompt: "Setup a local MongoDB cluster, do not specify a name",
40+
expectedToolCalls: [
41+
{
42+
toolName: "atlas-local-create-deployment",
43+
parameters: {},
44+
},
45+
],
46+
},
47+
{
48+
prompt: "If and only if, the local MongoDB deployment 'new-database' does not exist, then create it",
49+
expectedToolCalls: [
50+
{
51+
toolName: "atlas-local-list-deployments",
52+
parameters: {},
53+
},
54+
{
55+
toolName: "atlas-local-create-deployment",
56+
parameters: {
57+
deploymentName: "new-database",
58+
},
59+
},
60+
],
61+
},
62+
{
63+
prompt: "If and only if, the local MongoDB deployment 'existing-database' does not exist, then create it",
64+
mockedTools: {
65+
"atlas-local-list-deployments": (): CallToolResult => ({
66+
content: [
67+
{ type: "text", text: "Found 1 deployment:" },
68+
{
69+
type: "text",
70+
text: "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\nexisting-database | Running | 6.0",
71+
},
72+
],
73+
}),
74+
},
75+
expectedToolCalls: [
76+
{
77+
toolName: "atlas-local-list-deployments",
78+
parameters: {},
79+
},
80+
],
81+
},
82+
]);
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
2+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3+
4+
describeAccuracyTests([
5+
{
6+
prompt: "Delete the local MongoDB cluster called 'my-database'",
7+
expectedToolCalls: [
8+
{
9+
toolName: "atlas-local-delete-deployment",
10+
parameters: {
11+
deploymentName: "my-database",
12+
},
13+
},
14+
],
15+
},
16+
{
17+
prompt: "Delete the local MongoDB atlas database called 'my-instance'",
18+
expectedToolCalls: [
19+
{
20+
toolName: "atlas-local-delete-deployment",
21+
parameters: {
22+
deploymentName: "my-instance",
23+
},
24+
},
25+
],
26+
},
27+
{
28+
prompt: "Delete all my local MongoDB instances",
29+
mockedTools: {
30+
"atlas-local-list-deployments": (): CallToolResult => ({
31+
content: [
32+
{ type: "text", text: "Found 1 deployment:" },
33+
{
34+
type: "text",
35+
text: "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\nlocal-mflix | Running | 6.0\nlocal-comics | Running | 6.0",
36+
},
37+
],
38+
}),
39+
},
40+
expectedToolCalls: [
41+
{
42+
toolName: "atlas-local-list-deployments",
43+
parameters: {},
44+
},
45+
{
46+
toolName: "atlas-local-delete-deployment",
47+
parameters: {
48+
deploymentName: "local-mflix",
49+
},
50+
},
51+
{
52+
toolName: "atlas-local-delete-deployment",
53+
parameters: {
54+
deploymentName: "local-comics",
55+
},
56+
},
57+
],
58+
},
59+
{
60+
prompt: "If and only if, the local MongoDB deployment 'local-mflix' exists, then delete it",
61+
mockedTools: {
62+
"atlas-local-list-deployments": (): CallToolResult => ({
63+
content: [
64+
{ type: "text", text: "Found 1 deployment:" },
65+
{
66+
type: "text",
67+
text: "Deployment Name | State | MongoDB Version\n----------------|----------------|----------------\nlocal-mflix | Running | 6.0",
68+
},
69+
],
70+
}),
71+
},
72+
expectedToolCalls: [
73+
{
74+
toolName: "atlas-local-list-deployments",
75+
parameters: {},
76+
},
77+
{
78+
toolName: "atlas-local-delete-deployment",
79+
parameters: {
80+
deploymentName: "local-mflix",
81+
},
82+
},
83+
],
84+
},
85+
{
86+
prompt: "Create a local MongoDB cluster named 'local-mflix' then delete it immediately",
87+
expectedToolCalls: [
88+
{
89+
toolName: "atlas-local-create-deployment",
90+
parameters: {
91+
deploymentName: "local-mflix",
92+
},
93+
},
94+
{
95+
toolName: "atlas-local-delete-deployment",
96+
parameters: {
97+
deploymentName: "local-mflix",
98+
},
99+
},
100+
],
101+
},
102+
]);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { describeAccuracyTests } from "./sdk/describeAccuracyTests.js";
2+
3+
describeAccuracyTests([
4+
{
5+
prompt: "What MongoDB clusters do I have running?",
6+
expectedToolCalls: [
7+
{
8+
toolName: "atlas-local-list-deployments",
9+
parameters: {},
10+
},
11+
],
12+
},
13+
{
14+
prompt: "What MongoDB instances do I have running?",
15+
expectedToolCalls: [
16+
{
17+
toolName: "atlas-local-list-deployments",
18+
parameters: {},
19+
},
20+
],
21+
},
22+
{
23+
prompt: "How many MongoDB clusters are running?",
24+
expectedToolCalls: [
25+
{
26+
toolName: "atlas-local-list-deployments",
27+
parameters: {},
28+
},
29+
],
30+
},
31+
]);

0 commit comments

Comments
 (0)