Skip to main content
Glama
mongodb-js

MongoDB MCP Server

Official
by mongodb-js

explain

Read-only

Get execution statistics for MongoDB find, aggregate, and count queries to analyze the query optimizer's chosen plan and troubleshoot performance issues.

Instructions

Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYesThe method and its arguments to run
databaseYesDatabase name
verbosityNoThe verbosity of the explain plan, defaults to queryPlanner. If the user wants to know how fast is a query in execution time, use executionStats. It supports all verbosities as defined in the MongoDB Driver.queryPlanner
collectionYesCollection name
connectionIdYesThe connection to run the operation against. Use the id returned by one of the connect tools, or "preconfigured" to use the connection string the server was configured with.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYes
verbosityYes
explainResultYes
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds context beyond the annotations by clarifying that the tool returns optimizer plan statistics rather than the actual query results. Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is known. No contradiction exists, but the description does not disclose additional behavioral traits such as whether the query is actually executed or any cost implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 15 words, front-loaded with the action 'Returns statistics,' and contains zero redundant or filler content. It is appropriately sized for a tool whose parameters are fully documented in the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the high complexity of the input schema (nested method alternatives, vector search rules) and the presence of an output schema and safety annotations, the description is largely sufficient. It clearly states the tool's purpose, and the schema covers all method and parameter details. However, the lack of usage guidance is a notable gap, preventing a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with detailed descriptions for all five parameters, including the complex 'method' parameter and verbosity enum. The description itself adds no parameter-level detail, so it earns the baseline score of 3 for relying on the rich schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource: 'Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method.' It clearly indicates this is an EXPLAIN-style tool for a given method. However, it does not explicitly distinguish itself from sibling tools like find or aggregate, though the nature of the output implies it is not the actual query execution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention that it should be used instead of find/aggregate/count for analyzing query performance, nor does it state any exclusions or prerequisites. The only hint is the tool name and the phrase 'for the evaluated method,' which is insufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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