---
title: "MongoDB Performance Advisor: review, role & definition · Undominated.ai"
canonical: https://undominated.ai/agents/github-mongodb-performance-advisor/
description: "Combines repository query patterns with read-only MongoDB diagnostics to explain query plans and index trade-offs."
---

# MongoDB Performance Advisor: review, role & definition · Undominated.ai

> Combines repository query patterns with read-only MongoDB diagnostics to explain query plans and index trade-offs.

[← Explore all agents](/agents/)

DATA AND RETRIEVAL / github

# MongoDB Performance Advisor

Combines repository query patterns with read-only MongoDB diagnostics to explain query plans and index trade-offs.

 Use this definition ↓Original source ↗

SOURCE REVIEW

 Reviewed 2026-09-21
 Evidence 6 linked sources
 Publisher github
 Licence MIT ↗
 Revision ad4c196b933c
 Read what was—and wasn’t—checked ↓

“Analyze MongoDB database performance, offer query and index optimization insights and provide actionable recommendations to improve overall usage of the database.”

 github · upstream description ↗ Our analysis follows below.

01 / THE REASONING

## Why this made the selection.

 - Stops when a read-only MongoDB MCP connection is unavailable instead of fabricating database observations.
- Explicitly prohibits claims about performance gains from indexes that were not actually created and measured.

### A good fit for

 - Reviewing slow queries and aggregation pipelines against an attached MongoDB cluster.
- Separating observed query-plan evidence from index recommendations that still need testing.

### Weigh up before choosing

 - Requires the MongoDB MCP server configured read-only; Atlas Performance Advisor also needs the appropriate account access.
- Successful Advisor results can short-circuit deeper analysis in the source workflow, so coverage depends on the supplied diagnostics.
- Explain timings and count checks are useful observations but do not by themselves establish controlled performance gains or full result equivalence.
- The agent has no host tool allowlist; database read-only access does not restrict unrelated inherited file or shell tools.

02 / THE REVIEW RECORD

## What we actually inspected.

Source review has boundaries. A clear record is more useful than a “safe” badge.

### Material inspected

 - agents/mongodb-performance-advisor.agent.md (complete original frontmatter and body; strict YAML duplicate-key check)
- LICENSE (full applicable licence bytes and redistribution terms)
- Current official host configuration documentation; exact source and licence SHA-256 recorded

### Our findings

 - The workflow stops on an unavailable read-only MCP connection and forbids invented index-performance benefits.
- The official server documents readOnly registration restrictions. This database setting does not make the whole agent session read-only.

### Not established by this review

 - This agent has not been executed or benchmarked.
- Host discovery, configured tool availability, model behaviour and task outcomes were not runtime-tested.

The review applies to the material and revision named here. A newer upstream release can change its behavior.

03 / PUT IT TO WORK

## Use the role in your project.

Upstream setup instructions ↗
 - Download the original mongodb-performance-advisor.agent.md with its full licence and attribution; inspect the complete instructions and tool scope before use.
- Place the reviewed working copy at .github/agents/mongodb-performance-advisor.agent.md. Select the custom agent in VS Code’s agent picker.
- Use the host’s tool configuration to check every declared tool name and any MCP dependency. Confirm a pinned model is available or select a supported one in the working copy; never treat unknown tools as extra permission.
- Configure the official MongoDB MCP server in read-only mode and verify the expected read/metadata tools are actually available before invoking the agent.
- Attach the relevant repository and identify the database/collections and slow-query symptoms. Configure Atlas credentials separately if Performance Advisor is in scope.
- Request observed query-plan evidence and clearly separate untested index suggestions from measured results. Review proposed changes before applying any outside this role.

### Before you start

 - An authorised MongoDB connection, configured read-only MCP server and repository query code.
- Atlas Performance Advisor permissions when that optional source is used.

### Compatibility

GitHub Copilot custom agents in VS Code

### Read-only MongoDB diagnostics through MCP

 - No host tool allowlist is declared; non-database host tools remain governed by the host configuration.
- MongoDB MCP read-only mode excludes create/update/delete operation tools; use database credentials with the intended data access as well.

### Cost model

The definition is reusable under its stated licence. The host, model and connected services have their own access and billing terms.

THE COMPLETE REVIEWED DEFINITION

## Read it before you reuse it.

Original source bytes, with attribution. Review the host-specific setup notes above.

 Copy definition ↗ [Download definition + licence ↗](/resources/agents/github-mongodb-performance-advisor/bundle.zip)[Raw Markdown ↗](/resources/agents/github-mongodb-performance-advisor/definition.md)
 ---
name: mongodb-performance-advisor
description: Analyze MongoDB database performance, offer query and index optimization insights and provide actionable recommendations to improve overall usage of the database.
---

# Role

You are a MongoDB performance optimization specialist. Your goal is to analyze database performance metrics and codebase query patterns to provide actionable recommendations for improving MongoDB performance.

## Prerequisites

- MongoDB MCP Server which is already connected to a MongoDB Cluster and **is configured in readonly mode**.
- Highly recommended: Atlas Credentials on a M10 or higher MongoDB Cluster so you can access the `atlas-get-performance-advisor` tool.
- Access to a codebase with MongoDB queries and aggregation pipelines.
- You are already connected to a MongoDB Cluster in readonly mode via the MongoDB MCP Server. If this was not correctly set up, mention it in your report and stop further analysis.

## Instructions

### 1. Initial Codebase Database Analysis

a. Search codebase for relevant MongoDB operations, especially in application-critical areas.
b. Use the MongoDB MCP Tools like `list-databases`, `db-stats`, and `mongodb-logs` to gather context about the MongoDB database.
- Use `mongodb-logs` with `type: "global"` to find slow queries and warnings
- Use `mongodb-logs` with `type: "startupWarnings"` to identify configuration issues

### 2. Database Performance Analysis

**For queries and aggregations identified in the codebase:**

a. You must run the `atlas-get-performance-advisor` to get index and query recommendations about the data used. Prioritize the output from the performance advisor over any other information. Skip other steps if sufficient data is available. If the tool call fails or does not provide sufficient information, ignore this step and proceed.

b. Use `collection-schema` to identify high-cardinality fields suitable for optimization, according to their usage in the codebase

c. Use `collection-indexes` to identify unused, redundant, or inefficient indexes.

### 3. Query and Aggregation Review

For each identified query or aggregation pipeline, review the following:

a. Follow MongoDB best practices for pipeline design with regards to effective stage ordering, minimizing redundancy and consider potential tradeoffs of using indexes.
b. Run benchmarks using `explain` to get baseline metrics
1. **Test optimizations**: Re-run `explain` after you have applied the necessary modifications to the query or aggregation. Do not make any changes to the database itself.
2. **Compare results**: Document improvement in execution time and docs examined
3. **Consider side effects**: Mention trade-offs of your optimizations.
4. Validate that the query results remain unchanged with `count` or `find` operations.

**Performance Metrics to Track:**

- Execution time (ms)
- Documents examined vs returned ratio
- Index usage (IXSCAN vs COLLSCAN)
- Memory usage (especially for sorts and groups)
- Query plan efficiency

### 4. Deliverables
Provide a comprehensive report including:
- Summary of findings from database performance analysis
- Detailed review of each query and aggregation pipeline with:
 - Original vs optimized version
 - Performance metrics comparison
 - Explanation of optimizations and trade-offs
- Overall recommendations for database configuration, indexing strategies, and query design best practices.
- Suggested next steps for continuous performance monitoring and optimization.

You do not need to create new markdown files or scripts for this, you can simply provide all your findings and recommendations as output.

## Important Rules

- You are in **readonly mode** - use MCP tools to analyze, not modify
- If Performance Advisor is available, prioritize recommendations from the Performance Advisor over anything else.
- Since you are running in readonly mode, you cannot get statistics about the impact of index creation. Do not make statistical reports about improvements with an index and encourage the user to test it themselves.
- If the `atlas-get-performance-advisor` tool call failed, mention it in your report and recommend setting up the MCP Server's Atlas Credentials for a Cluster with Performance Advisor to get better results.
- Be **conservative** with index recommendations - always mention tradeoffs.
- Always back up recommendations with actual data instead of theoretical suggestions.
- Focus on **actionable** recommendations, not theoretical optimizations.

The download contains mongodb-performance-advisor.agent.md . Keep its filename when placing it in the agent directory described above.

By **github**. Exact upstream source ↗ · [Licence](/resources/agents/github-mongodb-performance-advisor/LICENSE.txt) · [Attribution](/resources/agents/github-mongodb-performance-advisor/ATTRIBUTION.txt)

SHA-256 35e9ef35e2ad3f39f9db2cc533f54224e9513d86747242d94b3c5e1d7f119d6c

 Read the applicable licence MIT License

Copyright GitHub, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

04 / FOLLOW THE EVIDENCE

## The source trail.

Our notes are separate from the original resource. Check upstream before adopting a new version.

 - Complete upstream definition at the reviewed revision ↗ Checked 2026-09-21 https://github.com/github/awesome-copilot/blob/ad4c196b933c5ca7f82a5ba78969ddcd2603ba80/agents/mongodb-performance-advisor.agent.md Supports: summary, upstreamDescription, whySelected, bestFor, limitations, review, access
- Applicable full upstream licence ↗ Checked 2026-09-21 https://github.com/github/awesome-copilot/blob/ad4c196b933c5ca7f82a5ba78969ddcd2603ba80/LICENSE Supports: license, artifact
- Current official custom-agent configuration ↗ Checked 2026-09-21 https://code.visualstudio.com/docs/agent-customization/custom-agents Supports: compatibility, install, access, limitations, review
- VS Code tool availability and permissions ↗ Checked 2026-09-21 https://code.visualstudio.com/docs/agents/run/tools Supports: install, access, limitations, review
- Official MongoDB MCP configuration ↗ Checked 2026-09-21 https://github.com/mongodb-js/mongodb-mcp-server#read-only-mode Supports: install, access, limitations, review
- MongoDB Performance Advisor over MCP ↗ Checked 2026-09-21 https://www.mongodb.com/docs/atlas/performance-advisor/access-with-mcp/ Supports: install, limitations, review

KEEP COMPARING

## Other approaches to consider.

Related by category or shared topics. These are alternatives to inspect, not a measured quality order.

 [### Database Cloud Optimization Database Optimizer ↗ Investigates database bottlenecks from query plans and workload evidence, then proposes query, index, caching or partitioning changes with validation.](/agents/wshobson-database-optimizer/)[### Rag Pipeline Reviewer ↗ Reviews retrieval pipelines for grounding, pruning, fallback behavior and evaluation policy, returning a structured approval, conditional approval or block decision.](/agents/ecc-rag-pipeline-reviewer/)[### Vector Database Engineer ↗ Plans and implements semantic retrieval systems through corpus analysis, embeddings, chunking, index selection, hybrid search, reranking and monitoring.](/agents/wshobson-vector-database-engineer/)

 [AI Tools ↗](/tools/)[Skills ↗](/skills/)[Agents ↗](/agents/)[MCP Servers ↗](/mcp-servers/)
