Skip to main content
Glama

MongoDB MCP Server

Official
by mongodb-js
listOrgs.ts1.12 kB
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { AtlasToolBase } from "../atlasTool.js"; import type { OperationType } from "../../tool.js"; import { formatUntrustedData } from "../../tool.js"; export class ListOrganizationsTool extends AtlasToolBase { public name = "atlas-list-orgs"; protected description = "List MongoDB Atlas organizations"; public operationType: OperationType = "read"; protected argsShape = {}; protected async execute(): Promise<CallToolResult> { const data = await this.session.apiClient.listOrgs(); if (!data?.results?.length) { return { content: [{ type: "text", text: "No organizations found in your MongoDB Atlas account." }], }; } const orgs = data.results.map((org) => ({ name: org.name, id: org.id, })); return { content: formatUntrustedData( `Found ${data.results.length} organizations in your MongoDB Atlas account.`, JSON.stringify(orgs) ), }; } }

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