Skip to main content
Glama

MongoDB MCP Server

by jonfreeland

explain_query

Analyze MongoDB query execution plans to identify indexes used, documents examined, and execution stages. Optimize slow queries by understanding query performance and behavior.

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" }

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/jonfreeland/mongodb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server