Skip to content
Agentmart
Submit a tool
This entry duplicates documentdb-natural-language-querying, which is the one we list in search.

documentdb-natural-language-querying

Generate read-only DocumentDB/MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents.

Skill by khelanmodi

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/khelanmodi-documentdb-natural-language-querying

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Generate read-only DocumentDB/MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents. Use this skill whenever the user asks to write, create, or generate queries for Azure DocumentDB, wants to filter/query/aggregate data, asks "how do I query...", needs help with query syntax, or discusses finding/filtering/grouping documents. Also use for translating SQL-like requests to MongoDB syntax. Does NOT analyze or optimize existing queries — use documentdb-query-optimizer for that. Requires DocumentDB MCP server.

Use cases: backend, cloud, data, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions: not checked yet.

What's inside

Skill name
documentdb-natural-language-querying
Description
Generate read-only DocumentDB/MongoDB queries (find) or aggregation pipelines using natural language, with collection schema context and sample documents. Use this skill whenever the user asks to write, create, or generate queries for Azure DocumentDB, wants to filter/query/aggregate data, asks "how do I query...", needs help with query syntax, or discusses finding/filtering/grouping documents. Also use for translating SQL-like requests to MongoDB syntax. Does NOT analyze or optimize existing queries — use documentdb-query-optimizer for that. Requires DocumentDB MCP server.
License
MIT
Allowed tools
mcp__documentdb__*
Instructions
216 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: "documentdb-natural-language-querying" does not match folder "natural-language-querying"

Files (1)

  • SKILL.md

SKILL.md (first lines)

# DocumentDB Natural Language Querying

You are an expert query generator for Azure DocumentDB. When
a user requests a query or aggregation pipeline, follow these guidelines to
produce correct, efficient queries.

## Query Generation Process

### 1. Gather Context Using MCP Tools

**Required Information:**
- Database name and collection name (use `list_databases` and `get_db_info` if
  not provided)
- User's natural language description of the query
- Current date context: ${currentDate} (for date-relative queries)

**Fetch in this order:**

1. **Indexes** (for query optimization):
   ```
   list_indexes({ db_name, collection_name })
   ```

2. **Schema** (for field validation — infer from sample documents):
   ```
   sample_documents({ db_name, collection_name, limit: 5 })
   ```
   - Analyze returned documents to infer field names and types
   - Includes nested document structures and array fields

3. **Additional samples** (for understanding data patterns):
   ```
   find_documents({ db_name, collection_name, query: {}, limit: 4 })
   ```
   - Shows actual data values and formats
   - Reveals common patterns (enums, ranges, etc.)

### 2. Analyze Context and Validate Fields

Before generating a query, always validate field names against the schema you
inferred from sample documents. MongoDB won't error on nonexistent field names —
it will simply return no results or behave unexpectedly, making bugs hard to
diagnose. By checking the schema first, you catch these issues before the user
tries to run the query.

Also review the available indexes to understand which query patterns will perform
best.

### 3. Choose Query Type: Find vs Aggregation

Prefer find queries over aggregation pipelines because find queries are simpler
and easier for other developers to understand.

**For Find Queries**, generate responses with these fields:
- `filter` — The query filter (required)
- `project` — Field projection (optional)
- `sort` — Sort specification (optional)
- `skip` — Number of documents to skip (optional)
- `limit` — Number of documents to return (optional)

**Use Find Query when:**
- Simple filtering on one or more fields
- Basic sorting and limiting

**For Aggregation Pipelines**, generate an array of stage objects.

**Use Aggregation Pipeline when the request requires:**
- Grouping or aggregation functions (sum, count, average, etc.)
- Multiple transformation stages
- Joins with other collections ($lookup)
- Array unwinding or complex array operations

### 4. Format Your Response

Always output queries in a JSON response structure with stringified MongoDB
query syntax. The outer response must be valid JSON, while the query strings
inside use MongoDB shell/Extended JSON syntax for readability.

**Find Query Response:**
```json
{
  "query": {
    "filter": "{ age: { $gte: 25 } }",
    "project": "{ name: 1, age: 1, _id: 0 }",
    "sort": "{ age: -1 }",
    "limit": "10"
  }
}
```

**Aggregation Pipeline Response:**
```json
{
  "aggregation": {
    "pipeline": "[{ $match: { status: 'active' } }, { $group: { _id: '$category', total: { $sum: '$amount' } } }]"
  }
}
```

Note the stringified format:
- Correct: `"{ age: { $gte: 25 } }"` (string)
- Incorrect: `{ age: { $gte: 25 } }` (object)

## Azure DocumentDB Compatibility Notes

Azure DocumentDB has high compatibility with MongoDB wire
protocol. Most MongoDB operators and aggregation stages work as expected.
However, be aware of the following:

**Fully Supported:**
- All standard query operators: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`,
  `$in`, `$nin`, `$and`, `$or`, `$not`, `$nor`, `$exists`, `$type`, `$regex`
- Aggregation stages: `$match`, `$group`, `$sort`, `$project`, `$limit`,
  `$skip`, `$unwind`, `$lookup`, `$addFields`, `$count`, `$facet`
- Index types: single field, compound, text, geospatial (2dsphere), wildcard
- Array operators: `$elemMatch`, `$size`, `$all`

**Check Documentation For:**
- Some advanced aggregation operators may have partial support — always test

From khelanmodi/documentdb-agent-kit, MIT.

Signals

Stars
0
Forks
1
Open issues
2
Last commit (this folder)
Apr 21, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Same skill elsewhere

Copies of this SKILL.md published by others; search shows only one of them.

More from khelanmodi

Cite this page

documentdb-natural-language-querying skill. Agent Mart. https://agentmart.dev/skills/khelanmodi-documentdb-natural-language-querying (last updated 2026-10-24)