@@ -2,9 +2,7 @@ import { z } from "zod";
22import { CallToolResult } from "@modelcontextprotocol/sdk/types.js" ;
33import { AtlasToolBase } from "../atlasTool.js" ;
44import { ToolArgs , OperationType } from "../../tool.js" ;
5- import { makeCurrentIpAccessListEntry } from "../../../common/atlas/accessListUtils.js" ;
6-
7- const DEFAULT_COMMENT = "Added by Atlas MCP" ;
5+ import { makeCurrentIpAccessListEntry , DEFAULT_ACCESS_LIST_COMMENT } from "../../../common/atlas/accessListUtils.js" ;
86
97export class CreateAccessListTool extends AtlasToolBase {
108 public name = "atlas-create-access-list" ;
@@ -18,7 +16,11 @@ export class CreateAccessListTool extends AtlasToolBase {
1816 . optional ( ) ,
1917 cidrBlocks : z . array ( z . string ( ) . cidr ( ) ) . describe ( "CIDR blocks to allow access from" ) . optional ( ) ,
2018 currentIpAddress : z . boolean ( ) . describe ( "Add the current IP address" ) . default ( false ) ,
21- comment : z . string ( ) . describe ( "Comment for the access list entries" ) . default ( DEFAULT_COMMENT ) . optional ( ) ,
19+ comment : z
20+ . string ( )
21+ . describe ( "Comment for the access list entries" )
22+ . default ( DEFAULT_ACCESS_LIST_COMMENT )
23+ . optional ( ) ,
2224 } ;
2325
2426 protected async execute ( {
@@ -35,22 +37,22 @@ export class CreateAccessListTool extends AtlasToolBase {
3537 const ipInputs = ( ipAddresses || [ ] ) . map ( ( ipAddress ) => ( {
3638 groupId : projectId ,
3739 ipAddress,
38- comment : comment || DEFAULT_COMMENT ,
40+ comment : comment || DEFAULT_ACCESS_LIST_COMMENT ,
3941 } ) ) ;
4042
4143 if ( currentIpAddress ) {
4244 const input = await makeCurrentIpAccessListEntry (
4345 this . session . apiClient ,
4446 projectId ,
45- comment || DEFAULT_COMMENT
47+ comment || DEFAULT_ACCESS_LIST_COMMENT
4648 ) ;
4749 ipInputs . push ( input ) ;
4850 }
4951
5052 const cidrInputs = ( cidrBlocks || [ ] ) . map ( ( cidrBlock ) => ( {
5153 groupId : projectId ,
5254 cidrBlock,
53- comment : comment || DEFAULT_COMMENT ,
55+ comment : comment || DEFAULT_ACCESS_LIST_COMMENT ,
5456 } ) ) ;
5557
5658 const inputs = [ ...ipInputs , ...cidrInputs ] ;
0 commit comments