MongoDB MCP Server

explain_query

Analyze and understand MongoDB query execution plans with detailed insights into index usage, documents examined, and execution stages to optimize slow queries.

Instructions

Get the execution plan for a query.

Helps understand:

  • How MongoDB will execute the query
  • Which indexes will be used
  • Number of documents examined
  • Execution stages and timing

Use this to optimize slow queries.

Input Schema

NameRequiredDescriptionDefault
collectionYesCollection name
databaseNoDatabase name (optional if default database is configured)
filterYesMongoDB query filter to explain
projectionNoMongoDB projection (optional)
sortNoMongoDB sort specification (optional)

Input Schema (JSON Schema)

{ "properties": { "collection": { "description": "Collection name", "type": "string" }, "database": { "description": "Database name (optional if default database is configured)", "type": "string" }, "filter": { "description": "MongoDB query filter to explain", "type": "object" }, "projection": { "description": "MongoDB projection (optional)", "type": "object" }, "sort": { "description": "MongoDB sort specification (optional)", "type": "object" } }, "required": [ "collection", "filter" ], "type": "object" }

You must be authenticated.

Other Tools from MongoDB MCP Server

Related Tools

ID: cmywezu1sn