Skip to content

Commit 5d454c6

Browse files
committed
fix: styles
1 parent 16115a7 commit 5d454c6

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

src/common/atlas/client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,10 @@ export class ApiClient {
275275
return await this.do<PaginatedNetworkAccessView>(`/groups/${groupId}/accessList`);
276276
}
277277

278-
async createProjectIpAccessList(groupId: string, entries: NetworkPermissionEntry[]): Promise<PaginatedNetworkAccessView> {
278+
async createProjectIpAccessList(
279+
groupId: string,
280+
entries: NetworkPermissionEntry[]
281+
): Promise<PaginatedNetworkAccessView> {
279282
return await this.do<PaginatedNetworkAccessView>(`/groups/${groupId}/accessList`, {
280283
method: "POST",
281284
body: JSON.stringify(entries),

src/tools/atlas/createAccessList.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,32 @@ export class CreateAccessListTool extends AtlasToolBase {
1111
protected description = "Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.";
1212
protected argsShape = {
1313
projectId: z.string().describe("Atlas project ID"),
14-
ipAddresses: z.array(z.string().ip({ version: "v4" })).describe("IP addresses to allow access from").optional(),
14+
ipAddresses: z
15+
.array(z.string().ip({ version: "v4" }))
16+
.describe("IP addresses to allow access from")
17+
.optional(),
1518
cidrBlocks: z.array(z.string().cidr()).describe("CIDR blocks to allow access from").optional(),
1619
comment: z.string().describe("Comment for the access list entries").default(DEFAULT_COMMENT).optional(),
1720
};
1821

19-
protected async execute({projectId, ipAddresses, cidrBlocks, comment}: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
22+
protected async execute({
23+
projectId,
24+
ipAddresses,
25+
cidrBlocks,
26+
comment,
27+
}: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
2028
await this.ensureAuthenticated();
2129

2230
if (!ipAddresses?.length && !cidrBlocks?.length) {
2331
throw new Error("Either ipAddresses or cidrBlocks must be provided.");
2432
}
2533

26-
console.error(`ipAddresses:`, JSON.stringify(ipAddresses, null, 2));
27-
console.error(`cidrBlocks:`, JSON.stringify(cidrBlocks, null, 2));
28-
29-
30-
3134
const ipInputs = (ipAddresses || []).map((ipAddress) => ({
3235
groupId: projectId,
3336
ipAddress,
3437
comment: comment || DEFAULT_COMMENT,
3538
}));
36-
39+
3740
const cidrInputs = (cidrBlocks || []).map((cidrBlock) => ({
3841
groupId: projectId,
3942
cidrBlock,

src/tools/atlas/inspectAccessList.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class InspectAccessListTool extends AtlasToolBase {
1010
projectId: z.string().describe("Atlas project ID"),
1111
};
1212

13-
protected async execute({projectId}: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
13+
protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
1414
await this.ensureAuthenticated();
1515

1616
const accessList = await this.apiClient.listProjectIpAccessLists(projectId);
@@ -23,13 +23,17 @@ export class InspectAccessListTool extends AtlasToolBase {
2323
content: [
2424
{
2525
type: "text",
26-
text: `IP ADDRESS | CIDR | COMMENT
26+
text:
27+
`IP ADDRESS | CIDR | COMMENT
2728
------|------|------
28-
` + (accessList.results || []).map((entry) => {
29-
return `${entry.ipAddress} | ${entry.cidrBlock} | ${entry.comment}`;
30-
}).join("\n")
31-
}
32-
]
29+
` +
30+
(accessList.results || [])
31+
.map((entry) => {
32+
return `${entry.ipAddress} | ${entry.cidrBlock} | ${entry.comment}`;
33+
})
34+
.join("\n"),
35+
},
36+
],
3337
};
3438
}
3539
}

0 commit comments

Comments
 (0)