Skip to main content
Glama

MongoDB MCP Server

Official
by mongodb-js
inspectCluster.ts1.73 kB
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { type OperationType, type ToolArgs, formatUntrustedData } from "../../tool.js"; import { AtlasToolBase } from "../atlasTool.js"; import type { Cluster } from "../../../common/atlas/cluster.js"; import { inspectCluster } from "../../../common/atlas/cluster.js"; import { AtlasArgs } from "../../args.js"; 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"; public operationType: OperationType = "read"; protected argsShape = { ...InspectClusterArgs, }; 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)), }; } }

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