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
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | Database 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, };
- src/tools/mongodb/metadata/dbStats.ts:8-8 (registration)Registers the tool with the name 'db-stats'.public name = "db-stats";
- src/tools/mongodb/tools.ts:12-12 (registration)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";