atlas-inspect-access-list
Check IP and CIDR ranges authorized to access MongoDB Atlas clusters to verify network security settings.
Instructions
Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Atlas project ID |
Implementation Reference
- The execute method fetches the access list entries from MongoDB Atlas API for the given projectId, processes the results, and returns a formatted response or a message if none found.protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> { const accessList = await this.session.apiClient.listAccessListEntries({ params: { path: { groupId: projectId, }, }, }); const results = accessList.results ?? []; if (!results.length) { return { content: [{ type: "text", text: "No access list entries found." }], }; } const entries = results.map((entry) => ({ ipAddress: entry.ipAddress, cidrBlock: entry.cidrBlock, comment: entry.comment, })); return { content: formatUntrustedData(`Found ${results.length} access list entries`, JSON.stringify(entries)), }; }
- Defines the input schema for the tool, requiring a projectId using AtlasArgs.projectId().export const InspectAccessListArgs = { projectId: AtlasArgs.projectId().describe("Atlas project ID"), }; export class InspectAccessListTool extends AtlasToolBase { public name = "atlas-inspect-access-list"; protected description = "Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters."; static operationType: OperationType = "read"; protected argsShape = { ...InspectAccessListArgs, };
- src/tools/atlas/read/inspectAccessList.ts:10-45 (registration)The InspectAccessListTool class definition, including name, description, operationType, argsShape, and execute method, which is instantiated and registered via the AllTools array in src/tools/index.ts.export class InspectAccessListTool extends AtlasToolBase { public name = "atlas-inspect-access-list"; protected description = "Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters."; static operationType: OperationType = "read"; protected argsShape = { ...InspectAccessListArgs, }; protected async execute({ projectId }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> { const accessList = await this.session.apiClient.listAccessListEntries({ params: { path: { groupId: projectId, }, }, }); const results = accessList.results ?? []; if (!results.length) { return { content: [{ type: "text", text: "No access list entries found." }], }; } const entries = results.map((entry) => ({ ipAddress: entry.ipAddress, cidrBlock: entry.cidrBlock, comment: entry.comment, })); return { content: formatUntrustedData(`Found ${results.length} access list entries`, JSON.stringify(entries)), }; } }
- src/tools/atlas/tools.ts:6-6 (registration)Re-exports the InspectAccessListTool for inclusion in the atlas tools namespace and subsequently in AllTools.export { InspectAccessListTool } from "./read/inspectAccessList.js";
- src/tools/index.ts:7-11 (registration)Collects all tools, including AtlasTools (which includes InspectAccessListTool), into AllTools array passed to the server for instantiation and registration.export const AllTools: ToolClass[] = Object.values({ ...MongoDbTools, ...AtlasTools, ...AtlasLocalTools, });