Skip to content

Commit 7e32ef1

Browse files
feat: add support for loading sample data to 'atlas-local-create-deployment' tool (#781)
1 parent 8b9cc4e commit 7e32ef1

File tree

5 files changed

+60
-32
lines changed

5 files changed

+60
-32
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
"node": "^20.19.0 || ^22.12.0 || >= 23.0.0"
141141
},
142142
"optionalDependencies": {
143-
"@mongodb-js/atlas-local": "^1.0.2",
143+
"@mongodb-js/atlas-local": "^1.1.0",
144144
"kerberos": "^2.2.2"
145145
},
146146
"pnpm": {

pnpm-lock.yaml

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/atlasLocal/create/createDeployment.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ import { AtlasLocalToolBase } from "../atlasLocalTool.js";
33
import type { OperationType, ToolArgs } from "../../tool.js";
44
import type { Client, CreateDeploymentOptions } from "@mongodb-js/atlas-local";
55
import { CommonArgs } from "../../args.js";
6+
import z from "zod";
67

78
export class CreateDeploymentTool extends AtlasLocalToolBase {
89
public name = "atlas-local-create-deployment";
910
protected description = "Create a MongoDB Atlas local deployment";
1011
static operationType: OperationType = "create";
1112
protected argsShape = {
1213
deploymentName: CommonArgs.string().describe("Name of the deployment to create").optional(),
14+
loadSampleData: z.boolean().describe("Load sample data into the deployment").optional().default(false),
1315
};
1416

1517
protected async executeWithAtlasLocalClient(
16-
{ deploymentName }: ToolArgs<typeof this.argsShape>,
18+
{ deploymentName, loadSampleData }: ToolArgs<typeof this.argsShape>,
1719
{ client }: { client: Client }
1820
): Promise<CallToolResult> {
1921
const deploymentOptions: CreateDeploymentOptions = {
@@ -22,6 +24,7 @@ export class CreateDeploymentTool extends AtlasLocalToolBase {
2224
type: "MCPServer",
2325
source: "MCPServer",
2426
},
27+
loadSampleData,
2528
doNotTrack: !this.telemetry.isTelemetryEnabled(),
2629
};
2730
// Create the deployment

tests/accuracy/createDeployment.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,28 @@ describeAccuracyTests([
7979
},
8080
],
8181
},
82+
{
83+
prompt: "Create a local MongoDB cluster named 'sample-cluster' with sample data",
84+
expectedToolCalls: [
85+
{
86+
toolName: "atlas-local-create-deployment",
87+
parameters: {
88+
deploymentName: "sample-cluster",
89+
loadSampleData: true,
90+
},
91+
},
92+
],
93+
},
94+
{
95+
prompt: "Create a local MongoDB cluster named 'empty-cluster' without sample data",
96+
expectedToolCalls: [
97+
{
98+
toolName: "atlas-local-create-deployment",
99+
parameters: {
100+
deploymentName: "empty-cluster",
101+
loadSampleData: false,
102+
},
103+
},
104+
],
105+
},
82106
]);

tests/integration/tools/atlas-local/createDeployment.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describeWithAtlasLocal("atlas-local-create-deployment", (integration) => {
3333
expect(createDeployment.inputSchema.type).toBe("object");
3434
expectDefined(createDeployment.inputSchema.properties);
3535
expect(createDeployment.inputSchema.properties).toHaveProperty("deploymentName");
36+
expect(createDeployment.inputSchema.properties).toHaveProperty("loadSampleData");
3637
});
3738

3839
it("should create a deployment when calling the tool", async () => {

0 commit comments

Comments
 (0)