File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 1+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
2+ import { AtlasLocalToolBase } from "../atlasLocalTool.js" ;
3+ import type { OperationType , ToolArgs } from "../../tool.js" ;
4+ import type { Client } from "@mongodb-js-preview/atlas-local" ;
5+ import type { CreateDeploymentOptions , CreationSourceType } from "@mongodb-js-preview/atlas-local" ;
6+ import z from "zod" ;
7+
8+ export class CreateDeploymentTool extends AtlasLocalToolBase {
9+ public name = "atlas-local-create-deployment" ;
10+ protected description = "Create a MongoDB Atlas local deployment" ;
11+ public operationType : OperationType = "create" ;
12+ protected argsShape = {
13+ deploymentName : z . string ( ) . describe ( "Name of the deployment to create" ) ,
14+ } ;
15+
16+ protected async executeWithAtlasLocalClient (
17+ client : Client ,
18+ { deploymentName } : ToolArgs < typeof this . argsShape >
19+ ) : Promise < CallToolResult > {
20+ const deploymentOptions : CreateDeploymentOptions = {
21+ name : deploymentName ,
22+ creationSource : "MCPServer" ,
23+ } ;
24+ // Create the deployment
25+ await client . createDeployment ( deploymentOptions ) ;
26+
27+ return {
28+ content : [ { type : "text" , text : `Deployment ${ deploymentName } created.` } ] ,
29+ } ;
30+ }
31+ }
Original file line number Diff line number Diff line change 11import { DeleteDeploymentTool } from "./delete/deleteDeployment.js" ;
22import { ListDeploymentsTool } from "./read/listDeployments.js" ;
3+ import { CreateDeploymentTool } from "./create/createDeployment.js" ;
34
4- export const AtlasLocalTools = [ ListDeploymentsTool , DeleteDeploymentTool ] ;
5+ export const AtlasLocalTools = [ ListDeploymentsTool , DeleteDeploymentTool , CreateDeploymentTool ] ;
You can’t perform that action at this time.
0 commit comments