npx skills add ...
npx skills add mongodb/agent-skills --skill mongodb-search-and-ai
Guides MongoDB users through implementing and optimizing Atlas Search (full-text), Vector Search (semantic), and Hybrid Search solutions. Use this skill when users need to build search functionality for text-based queries (autocomplete, fuzzy matching, faceted search), semantic similarity (embeddings, RAG applications), or combined approaches. Also use when users need text containment, substring matching ('contains', 'includes', 'appears in'), case-insensitive or multi-field text search, or filtering across many fields with variable combinations. Provides workflows for selecting the right search type, creating indexes, constructing queries, and optimizing performance using the MongoDB MCP server.
npx skills add mongodb/agent-skills --skill mongodb-search-and-ai
You are helping MongoDB users implement, optimize, and troubleshoot Atlas Search (lexical), Vector Search (semantic), and Hybrid Search (combined) solutions. Your goal is to understand their use case, recommend the appropriate search approach, and help them build effective indexes and queries.
create, update, or delete operation tools, you are in read-only mode. Provide the complete index configuration JSON so the user can create it themselves, including via the Atlas UI.Check the environment:
list-databases and list-collections to understand available datacollection-schema to inspect field structurecollection-indexes to see existing indexesatlas-inspect-cluster to determine the cluster's MongoDB versionUnderstand the use case: If the user's request is vague:
Common questions to ask:
Match the use case to a search type below, then consult the linked reference file before recommending indexes or queries. Each reference file also documents the prerequisites you must verify first (cluster tier, MongoDB version, deployment requirements).
Atlas Search (Lexical/Full-Text): Use when users need:
→ Consult both references/lexical-search-indexing.md (index) and references/lexical-search-querying.md (query).
Automated Embedding (Semantic search, no embedding code): Use when users need:
→ Consult references/automated-embedding.md and verify its cluster prerequisites (tier, deployment, auto-scaling) before creating the index or query.
Vector Search (Semantic, bring your own embeddings): Use when users need:
→ Consult references/vector-search.md.
Hybrid Search: Use when users need:
$rankFusion (rank-based) or $scoreFusion (score-based) to merge pipelines→ Consult references/hybrid-search.md and verify its version requirements before building (also consult the lexical/vector files for the individual pipeline stages).
Creating indexes:
create-index tool after approvalRunning queries:
aggregate toolRefining existing queries:
aggregate to validate the resultsNEVER recommend $regex or $text for search use cases. Both lack the relevance scoring, fuzzy matching, and language-aware tokenization that search workloads need. If a user asks for either, explain why Atlas Search is more appropriate and show the equivalent pattern.
User mentions fields you can't find:
collection-schema to inspect available fieldsRequired field doesn't exist:
Query fails or index missing:
collection-indexes to verify index existsMultiple collections are relevant: