Suggest a MongoDB index
suggest_mongo_indexGenerates MongoDB createIndex commands for unindexed fields plus compound and text indexes, with an explain query to verify. Use when a collection scan is flagged or filtering on an unindexed field.
Instructions
Generates the exact db.collection.createIndex() command for a MongoDB field, plus compound and text index variants and an explain query to verify. Call this when a collection scan is flagged by the analyzer or when writing a query that filters on an unindexed field. Does not check whether the index already exists.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"collection": "<collection>",
"field": "<field>"
},
"name": "suggest_mongo_index"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field | Yes | Field name to index | |
| collection | Yes | MongoDB collection name |