Skip to main content
Glama
mongodb-js

MongoDB MCP Server

Official
by mongodb-js

atlas-inspect-cluster

Analyze MongoDB Atlas cluster configuration and status by providing project ID and cluster name to monitor performance and identify issues.

Instructions

Inspect MongoDB Atlas cluster

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesAtlas project ID
clusterNameYesAtlas cluster name

Implementation Reference

  • Registration of all tools including AtlasTools (which re-exports InspectClusterTool) into the AllTools array for MCP tool provision.
    import * as AtlasTools from "./atlas/tools.js"; import * as AtlasLocalTools from "./atlasLocal/tools.js"; import * as MongoDbTools from "./mongodb/tools.js"; import type { ToolClass } from "./tool.js"; // Export the collection of tools for easier reference export const AllTools: ToolClass[] = Object.values({ ...MongoDbTools, ...AtlasTools, ...AtlasLocalTools, });
  • The tool's execute handler fetches cluster details via helper and formats output.
    protected async execute({ projectId, clusterName }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> { const cluster = await inspectCluster(this.session.apiClient, projectId, clusterName); return this.formatOutput(cluster); } private formatOutput(formattedCluster: Cluster): CallToolResult { const clusterDetails = { name: formattedCluster.name || "Unknown", instanceType: formattedCluster.instanceType, instanceSize: formattedCluster.instanceSize || "N/A", state: formattedCluster.state || "UNKNOWN", mongoDBVersion: formattedCluster.mongoDBVersion || "N/A", connectionStrings: formattedCluster.connectionStrings || {}, }; return { content: formatUntrustedData("Cluster details:", JSON.stringify(clusterDetails)), }; }
  • Input schema definition for projectId and clusterName using AtlasArgs.
    export const InspectClusterArgs = { projectId: AtlasArgs.projectId().describe("Atlas project ID"), clusterName: AtlasArgs.clusterName().describe("Atlas cluster name"), }; export class InspectClusterTool extends AtlasToolBase { public name = "atlas-inspect-cluster"; protected description = "Inspect MongoDB Atlas cluster"; static operationType: OperationType = "read"; protected argsShape = { ...InspectClusterArgs, };
  • Re-export of InspectClusterTool for inclusion in AtlasTools.
    export { InspectClusterTool } from "./read/inspectCluster.js";
  • Core helper function that calls Atlas API to inspect cluster (both dedicated and flex) and formats the response.
    export async function inspectCluster(apiClient: ApiClient, projectId: string, clusterName: string): Promise<Cluster> { try { const cluster = await apiClient.getCluster({ params: { path: { groupId: projectId, clusterName, }, }, }); return formatCluster(cluster); } catch (error) { try { const cluster = await apiClient.getFlexCluster({ params: { path: { groupId: projectId, name: clusterName, }, }, }); return formatFlexCluster(cluster); } catch (flexError) { const err = flexError instanceof Error ? flexError : new Error(String(flexError)); apiClient.logger.error({ id: LogId.atlasInspectFailure, context: "inspect-cluster", message: `error inspecting cluster: ${err.message}`, }); throw error; } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mongodb-js/mongodb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server