Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"node": "^20.19.0 || ^22.12.0 || >= 23.0.0"
},
"optionalDependencies": {
"@mongodb-js/atlas-local": "^1.0.2",
"@mongodb-js/atlas-local": "^1.1.0",
"kerberos": "^2.2.2"
},
"pnpm": {
Expand Down
60 changes: 30 additions & 30 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/tools/atlasLocal/create/createDeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@ import { AtlasLocalToolBase } from "../atlasLocalTool.js";
import type { OperationType, ToolArgs } from "../../tool.js";
import type { Client, CreateDeploymentOptions } from "@mongodb-js/atlas-local";
import { CommonArgs } from "../../args.js";
import z from "zod";

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

protected async executeWithAtlasLocalClient(
client: Client,
{ deploymentName }: ToolArgs<typeof this.argsShape>
{ deploymentName, loadSampleData }: ToolArgs<typeof this.argsShape>
): Promise<CallToolResult> {
const deploymentOptions: CreateDeploymentOptions = {
name: deploymentName,
creationSource: {
type: "MCPServer",
source: "MCPServer",
},
loadSampleData,
doNotTrack: !this.telemetry.isTelemetryEnabled(),
};
// Create the deployment
Expand Down
24 changes: 24 additions & 0 deletions tests/accuracy/createDeployment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,28 @@ describeAccuracyTests([
},
],
},
{
prompt: "Create a local MongoDB cluster named 'sample-cluster' with sample data",
expectedToolCalls: [
{
toolName: "atlas-local-create-deployment",
parameters: {
deploymentName: "sample-cluster",
loadSampleData: true,
},
},
],
},
{
prompt: "Create a local MongoDB cluster named 'empty-cluster' without sample data",
expectedToolCalls: [
{
toolName: "atlas-local-create-deployment",
parameters: {
deploymentName: "empty-cluster",
loadSampleData: false,
},
},
],
},
]);
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describeWithAtlasLocal("atlas-local-create-deployment", (integration) => {
expect(createDeployment.inputSchema.type).toBe("object");
expectDefined(createDeployment.inputSchema.properties);
expect(createDeployment.inputSchema.properties).toHaveProperty("deploymentName");
expect(createDeployment.inputSchema.properties).toHaveProperty("loadSampleData");
});

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