Skip to main content
Glama
mongodb-js

MongoDB MCP Server

Official
by mongodb-js

db-stats

Retrieve database usage statistics for MongoDB Atlas resources to monitor and analyze performance, storage, and operational state efficiently.

Instructions

Returns statistics that reflect the use state of a single database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesDatabase name

Implementation Reference

  • The main handler function that connects to MongoDB, runs the dbStats command on the specified database, and returns formatted statistics.
    protected async execute({ database }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> { const provider = await this.ensureConnected(); const result = await provider.runCommandWithCheck(database, { dbStats: 1, scale: 1, }); return { content: formatUntrustedData(`Statistics for database ${database}`, EJSON.stringify(result)), }; }
  • Defines the input schema for the tool, requiring a 'database' parameter.
    protected argsShape = { database: DbOperationArgs.database, };
  • Registers the tool with the name 'db-stats'.
    public name = "db-stats";
  • Re-exports the DbStatsTool for use in the MongoDB tools module.
    export { DbStatsTool } from "./metadata/dbStats.js";
  • Tool description defining its purpose.
    protected description = "Returns statistics that reflect the use state of a single database";

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