File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import { z } from "zod" ;
2+ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
3+ import { AtlasToolBase } from "./atlasTool.js" ;
4+ import { ToolArgs , OperationType } from "../tool.js" ;
5+ import { Group } from "../../common/atlas/openapi.js" ;
6+
7+ export class CreateProjectTool extends AtlasToolBase {
8+ protected name = "atlas-create-project" ;
9+ protected description = "Create a MongoDB Atlas project" ;
10+ protected operationType : OperationType = "create" ;
11+ protected argsShape = {
12+ projectName : z . string ( ) . describe ( "Name for the new project" ) ,
13+ organizationId : z . string ( ) . describe ( "Organization ID for the new project" ) ,
14+ } ;
15+
16+ protected async execute ( {
17+ projectName,
18+ organizationId,
19+ } : ToolArgs < typeof this . argsShape > ) : Promise < CallToolResult > {
20+ this . session . ensureAuthenticated ( ) ;
21+
22+ const input = {
23+ name : projectName ,
24+ orgId : organizationId ,
25+ } as Group ;
26+
27+ await this . session . apiClient . createProject ( {
28+ body : input ,
29+ } ) ;
30+
31+ return {
32+ content : [ { type : "text" , text : `Project "${ projectName } " created successfully.` } ] ,
33+ } ;
34+ }
35+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { CreateAccessListTool } from "./createAccessList.js";
66import { InspectAccessListTool } from "./inspectAccessList.js" ;
77import { ListDBUsersTool } from "./listDBUsers.js" ;
88import { CreateDBUserTool } from "./createDBUser.js" ;
9+ import { CreateProjectTool } from "./createProject.js" ;
910
1011export const AtlasTools = [
1112 ListClustersTool ,
@@ -16,4 +17,5 @@ export const AtlasTools = [
1617 InspectAccessListTool ,
1718 ListDBUsersTool ,
1819 CreateDBUserTool ,
20+ CreateProjectTool ,
1921] ;
You can’t perform that action at this time.
0 commit comments