Run Aggregation Pipeline
aggregateRun read-only MongoDB aggregation pipelines to analyze and transform data without modifying the database.
Instructions
Run a read-only MongoDB aggregation pipeline on a collection ($out and $merge are not allowed)
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>",
"pipeline": "<pipeline>"
},
"name": "aggregate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Optional database to read from for this call only, without changing the active connection | |
| pipeline | Yes | Pipeline stages as Extended JSON, e.g. [{"$match": {"status": "active"}}, {"$group": {"_id": "$type", "n": {"$sum": 1}}}] | |
| collection | Yes | Collection name |