Skip to main content
Glama
mongodb-js

MongoDB MCP Server

Official
by mongodb-js

export

Read-only

Save MongoDB query or aggregation results as EJSON, choosing relaxed or canonical format.

Instructions

Export a query or aggregation results in the specified EJSON format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesDatabase name
collectionYesCollection name
exportTitleYesA short description to uniquely identify the export.
connectionIdYesThe connection to run the operation against. Use the id returned by one of the connect tools, or "preconfigured" to use the connection string the server was configured with.
exportTargetYesThe export target along with its arguments.
jsonExportFormatNoThe format to be used when exporting collection data as EJSON with default being relaxed. relaxed: A string format that emphasizes readability and interoperability at the expense of type preservation. That is, conversion from relaxed format to BSON can lose type information. canonical: A string format that emphasizes type preservation at the expense of readability and interoperability. That is, conversion from canonical to BSON will generally preserve type information except in certain specific cases.relaxed

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed4 schema fields changedv2.0.0
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / connectionId
      Added value: +{
      +  "description": "The connection to run the operation against. Use the id returned by one of the connect tools, or \"preconfigured\" to use the connection string the server was configured with.",
      +  "type": "string"
      +}
    • changedInput schema / properties / exportTarget / items / oneOf
      Previous value: -[
      -  {
      -    "properties": {
      -      "arguments": {
      -        "description": "The arguments for 'find' operation.",
      -        "properties": {
      -          "filter": {
      -            "additionalProperties": {},
      -            "description": "The query filter, matching the syntax of the query argument of db.collection.find()",
      -            "properties": {},
      -            "type": "object"
      -          },
      -          "limit": {
      -            "type": "number"
      -          },
      -          "projection": {
      -            "additionalProperties": {},
      -            "description": "The projection, matching the syntax of the projection argument of db.collection.find()",
      -            "properties": {},
      -            "type": "object"
      -          },
      -          "sort": {
      -            "additionalProperties": {
      -              "anyOf": [
      -                {
      -                  "const": 1,
      -                  "type": "number"
      -                },
      -                {
      -                  "const": -1,
      -                  "type": "number"
      -                },
      -                {
      -                  "const": "asc",
      -                  "type": "string"
      -                },
      -                {
      -                  "const": "desc",
      -                  "type": "string"
      -                },
      -                {
      -                  "const": "ascending",
      -                  "type": "string"
      -                },
      -                {
      -                  "const": "descending",
      -                  "type": "string"
      -                },
      -                {
      -                  "properties": {
      -                    "$meta": {
      -                      "type": "string"
      -                    }
      -                  },
      -                  "required": [
      -                    "$meta"
      -                  ],
      -                  "type": "object"
      -                }
      -              ],
      -              "description": "The sort key and its direction"
      -            },
      -            "description": "A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for ascending, -1 for descending).",
      -            "propertyNames": {
      -              "type": "string"
      -            },
      -            "type": "object"
      -          }
      -        },
      -        "type": "object"
      -      },
      -      "name": {
      -        "const": "find",
      -        "description": "The literal name 'find' to represent a find cursor as target.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "name",
      -      "arguments"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "arguments": {
      -        "description": "The arguments for 'aggregate' operation.",
      -        "properties": {
      -          "pipeline": {
      -            "description": "An array of aggregation stages to execute.\nIf the user has asked for a vector search, `$vectorSearch` **MUST** be the first stage of the pipeline, or the first stage of a `$unionWith` subpipeline.\nIf the user has asked for lexical/Atlas search, use `$search` instead of `$text`.\n### Usage Rules for `$vectorSearch`\n- **Index Type Detection:**\n  Use the collection-indexes tool to determine if the target field has a classic vector index (type: 'vector') or an auto-embed index (type: 'autoEmbed').\n- **Classic Vector Search (type: 'vector'):**\n  Use 'queryVector' with embeddings as an array of numbers.\n- **Auto-Embed Vector Search (type: 'autoEmbed'):**\n  Use 'query' - MongoDB automatically generates embeddings at query time. Do NOT use 'queryVector' or 'embeddingParameters' for auto-embed indexes.\n- **Unset embeddings:**\n  Unless the user explicitly requests the embeddings, add an `$unset` stage **at the end of the pipeline** to remove the embedding field and avoid context limits. **The $unset stage in this situation is mandatory**.\n- **Pre-filtering:**\n  If the user requests additional filtering, include filters in `$vectorSearch.filter` only for pre-filter fields in the vector index.\n  NEVER include fields in $vectorSearch.filter that are not part of the vector index.\n- **Post-filtering:**\n  For all remaining filters, add a $match stage after $vectorSearch.\n- If unsure which fields are filterable, use the collection-indexes tool to determine valid prefilter fields.\n- If no requested filters are valid prefilters, omit the filter key from $vectorSearch.\n\n### Usage Rules for `$search`\n- Include the index name, unless you know for a fact there's a default index. If unsure, use the collection-indexes tool to determine the index name.\n- The `$search` stage supports multiple operators, such as 'autocomplete', 'text', 'geoWithin', and others. Choose the approprate operator based on the user's query. If unsure of the exact syntax, consult the MongoDB Atlas Search documentation, which can be found here: https://www.mongodb.com/docs/atlas/atlas-search/operators-and-collectors/\n",
      -            "items": {
      -              "anyOf": [
      -                {
      -                  "properties": {
      -                    "$vectorSearch": {
      -                      "anyOf": [
      -                        {
      -                          "description": "Classic vector search using 'queryVector'. Use this when the indexed field has a classic vector index (type: 'vector'). Note to LLM: Use the collection-indexes tool to verify the target field has a classic vector index before using 'queryVector'.",
      -                          "properties": {
      -                            "exact": {
      -                              "default": false,
      -                              "description": "When true, uses an ENN algorithm, otherwise uses ANN. Using ENN is not compatible with numCandidates, in that case, numCandidates must be left empty.",
      -                              "type": "boolean"
      -                            },
      -                            "filter": {
      -                              "additionalProperties": {},
      -                              "description": "MQL filter that can only use filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for filtering.",
      -                              "properties": {},
      -                              "type": "object"
      -                            },
      -                            "index": {
      -                              "description": "Name of the index, as retrieved from the `collection-indexes` tool.",
      -                              "type": "string"
      -                            },
      -                            "limit": {
      -                              "default": 10,
      -                              "exclusiveMinimum": 0,
      -                              "maximum": 9007199254740991,
      -                              "type": "integer"
      -                            },
      -                            "numCandidates": {
      -                              "description": "Number of candidates for the ANN algorithm. Mandatory when exact is false.",
      -                              "exclusiveMinimum": 0,
      -                              "maximum": 9007199254740991,
      -                              "type": "integer"
      -                            },
      -                            "path": {
      -                              "description": "Field, in dot notation, where to search. There must be a vector search index for that field.",
      -                              "type": "string"
      -                            },
      -                            "queryVector": {
      -                              "description": "The vector embeddings to search for when using classic vector search indexes (type: 'vector'). Provide embeddings as an array of numbers. Use this for classic vector indexes. For auto-embed indexes (type: 'autoEmbed'), use 'query' instead.",
      -                              "items": {
      -                                "type": "number"
      -                              },
      -                              "type": "array"
      -                            }
      -                          },
      -                          "required": [
      -                            "index",
      -                            "path",
      -                            "queryVector"
      -                          ],
      -                          "type": "object"
      -                        },
      -                        {
      -                          "description": "Auto-embed vector search using 'query'. Use this when the indexed field has an auto-embed index (type: 'autoEmbed'). Note to LLM: Use the collection-indexes tool to verify the target field has an auto-embed index before using 'query'.",
      -                          "properties": {
      -                            "exact": {
      -                              "default": false,
      -                              "description": "When true, uses an ENN algorithm, otherwise uses ANN. Using ENN is not compatible with numCandidates, in that case, numCandidates must be left empty.",
      -                              "type": "boolean"
      -                            },
      -                            "filter": {
      -                              "additionalProperties": {},
      -                              "description": "MQL filter that can only use filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for filtering.",
      -                              "properties": {},
      -                              "type": "object"
      -                            },
      -                            "index": {
      -                              "description": "Name of the index, as retrieved from the `collection-indexes` tool.",
      -                              "type": "string"
      -                            },
      -                            "limit": {
      -                              "default": 10,
      -                              "exclusiveMinimum": 0,
      -                              "maximum": 9007199254740991,
      -                              "type": "integer"
      -                            },
      -                            "model": {
      -                              "description": "The embedding model to use for generating embeddings from the query text. If not specified, defaults to the model configured in the auto-embed index definition.",
      -                              "enum": [
      -                                "voyage-4",
      -                                "voyage-4-large",
      -                                "voyage-4-lite",
      -                                "voyage-code-3"
      -                              ],
      -                              "type": "string"
      -                            },
      -                            "numCandidates": {
      -                              "description": "Number of candidates for the ANN algorithm. Mandatory when exact is false.",
      -                              "exclusiveMinimum": 0,
      -                              "maximum": 9007199254740991,
      -                              "type": "integer"
      -                            },
      -                            "path": {
      -                              "description": "Field, in dot notation, where to search. There must be a vector search index for that field.",
      -                              "type": "string"
      -                            },
      -                            "query": {
      -                              "description": "The query to search for when using auto-embed indexes (type: 'autoEmbed'). MongoDB will automatically generate embeddings for the text at query time. Use this for auto-embed indexes, not 'queryVector'.",
      -                              "properties": {
      -                                "text": {
      -                                  "description": "The text query to search for.",
      -                                  "type": "string"
      -                                }
      -                              },
      -                              "required": [
      -                                "text"
      -                              ],
      -                              "type": "object"
      -                            }
      -                          },
      -                          "required": [
      -                            "index",
      -                            "path",
      -                            "query"
      -                          ],
      -                          "type": "object"
      -                        }
      -                      ]
      -                    }
      -                  },
      -                  "required": [
      -                    "$vectorSearch"
      -                  ],
      -                  "type": "object"
      -                },
      -                {
      -                  "additionalProperties": {},
      -                  "properties": {},
      -                  "type": "object"
      -                }
      -              ]
      -            },
      -            "type": "array"
      -          }
      -        },
      -        "required": [
      -          "pipeline"
      -        ],
      -        "type": "object"
      -      },
      -      "name": {
      -        "const": "aggregate",
      -        "description": "The literal name 'aggregate' to represent an aggregation cursor as target.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "name",
      -      "arguments"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "properties": {
      +      "arguments": {
      +        "description": "The arguments for 'find' operation.",
      +        "properties": {
      +          "filter": {
      +            "additionalProperties": {},
      +            "description": "The query filter, matching the syntax of the query argument of db.collection.find()",
      +            "properties": {},
      +            "type": "object"
      +          },
      +          "limit": {
      +            "type": "number"
      +          },
      +          "projection": {
      +            "additionalProperties": {},
      +            "description": "The projection, matching the syntax of the projection argument of db.collection.find()",
      +            "properties": {},
      +            "type": "object"
      +          },
      +          "sort": {
      +            "additionalProperties": {
      +              "anyOf": [
      +                {
      +                  "const": 1,
      +                  "type": "number"
      +                },
      +                {
      +                  "const": -1,
      +                  "type": "number"
      +                },
      +                {
      +                  "const": "asc",
      +                  "type": "string"
      +                },
      +                {
      +                  "const": "desc",
      +                  "type": "string"
      +                },
      +                {
      +                  "const": "ascending",
      +                  "type": "string"
      +                },
      +                {
      +                  "const": "descending",
      +                  "type": "string"
      +                },
      +                {
      +                  "properties": {
      +                    "$meta": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "required": [
      +                    "$meta"
      +                  ],
      +                  "type": "object"
      +                }
      +              ],
      +              "description": "The sort key and its direction"
      +            },
      +            "description": "A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for ascending, -1 for descending).",
      +            "propertyNames": {
      +              "type": "string"
      +            },
      +            "type": "object"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "name": {
      +        "const": "find",
      +        "description": "The literal name 'find' to represent a find cursor as target.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "arguments"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "arguments": {
      +        "description": "The arguments for 'aggregate' operation.",
      +        "properties": {
      +          "pipeline": {
      +            "description": "An array of aggregation stages to execute.\n\nIf the user has asked for a vector search, `$vectorSearch` **MUST** be the first stage\nof the pipeline (or the first stage of a `$unionWith` sub-pipeline only when explicitly\ncombining unrelated result sets — for hybrid full-text + vector search, use `$rankFusion`\nor `$scoreFusion` instead, see below).\n\nIf the user has asked for lexical/Atlas search, use `$search` instead of `$text`.\n### Usage Rules for `$vectorSearch`\n- **Index Type Detection:**\n  Use the collection-indexes tool to determine if the target field has a classic vector index (type: 'vector') or an auto-embed index (type: 'autoEmbed').\n- **Classic Vector Search (type: 'vector'):**\n  Use 'queryVector' with embeddings as an array of numbers.\n- **Auto-Embed Vector Search (type: 'autoEmbed'):**\n  Use 'query' - MongoDB automatically generates embeddings at query time. Do NOT use 'queryVector' or 'embeddingParameters' for auto-embed indexes.\n- **Unset embeddings:**\n  Unless the user explicitly requests the embeddings, add an `$unset` stage **at the end of the pipeline** to remove the embedding field and avoid context limits. **The $unset stage in this situation is mandatory**.\n- **Pre-filtering:**\n  If the user requests additional filtering, include filters in `$vectorSearch.filter` only for pre-filter fields in the vector index.\n  NEVER include fields in $vectorSearch.filter that are not part of the vector index.\n- **Post-filtering:**\n  For all remaining filters, add a $match stage after $vectorSearch.\n- If unsure which fields are filterable, use the collection-indexes tool to determine valid prefilter fields.\n- If no requested filters are valid prefilters, omit the filter key from $vectorSearch.\n\n### Usage Rules for `$search`\n- Include the index name, unless you know for a fact there's a default index. If unsure, use the collection-indexes tool to determine the index name.\n- The `$search` stage supports multiple operators, such as 'autocomplete', 'text', 'geoWithin', and others. Choose the appropriate operator based on the user's query. If unsure of the exact syntax, consult the MongoDB Atlas Search documentation, which can be found here: https://www.mongodb.com/docs/atlas/atlas-search/operators-and-collectors/\n\n### Usage Rules for `$rankFusion` and `$scoreFusion` (Hybrid Search)\nUse these stages when the user wants to combine full-text (`$search`) and vector\n(`$vectorSearch`) retrieval into a single fused result set. **Prefer native\nfusion over a `$unionWith` + `$group` workaround** — the workaround averages\nincompatible score scales and produces wrong rankings.\n\n**Which stage to use:**\n- `$rankFusion` (MongoDB 8.0+) — Reciprocal Rank Fusion. The recommended default.\n  Normalizes scores across incompatible scales automatically. No score tuning needed.\n- `$scoreFusion` (MongoDB 8.2+) — Score-based fusion. Use when the user needs explicit\n  per-pipeline weights, score normalisation (sigmoid / minMaxScaler), or a custom\n  combination expression.\n\n**Construction rules:**\n- `$rankFusion` / `$scoreFusion` MUST be the first stage of the top-level pipeline.\n- Sub-pipelines go inside `input.pipelines` as a named map (not an array). Each name\n  must be non-empty, must not start with `$`, and must not contain `.` or null bytes.\n- Allowed stages inside sub-pipelines: `$search`, `$vectorSearch`, `$match`, `$sort`,\n  `$geoNear`, `$skip`, `$limit`. `$project` and `$unset` are NOT allowed inside sub-pipelines.\n- Do field shaping (`$project` / `$unset`) only AFTER the fusion stage, at the root.\n- Both a vectorSearch (or autoEmbed) index AND a search (lexical) index must exist on\n  the collection. Use the collection-indexes tool to confirm both before running a hybrid query.\n- Add a `$limit` stage after the fusion stage to cap the final result set.\n- Add `$unset` at the end to remove embedding fields and avoid context bloat.\n\n### Usage Rules for `$rerank` (Native Reranking)\nUse this stage when the user wants to reorder a set of candidate documents using a cross-encoder reranker model.\n\n**Construction rules:**\n- `$rerank` can be any stage in the pipeline on an Atlas cluster running MongoDB 8.3 or higher.\n- It is recommended to use `$rerank` after a sorted pipeline, e.g. `$search`, `$vectorSearch`, `$rankFusion`, `$scoreFusion`, or [`$match`, `$sort`].\n- $rerank must be enabled via the Native Reranking Project Setting\n- Set `numDocsToRerank` as the number of documents passed into `$rerank`. This will also limit the number of documents returned by `$rerank`\n- Set `path` as a field name or an array of field names that exist in all documents. Use `$match` or `$set` before `$rerank` to validate no fields are missing.\n- Add `$addFields` after `$rerank` to retrieve the reranker score.\n\n**`$rerank` example (recommended default):**\n```javascript\n[\n  {\n    $match: {\n      description: { $exists: true },\n      name: { $exists: true }\n    }\n  },\n  {\n    $sort: {\n      lastUpdated: -1\n    }\n  },\n  {\n    $rerank: {\n      query: {\n        text: \"query text including instructions\"\n      },\n      model: \"rerank-2.5\",\n      numDocsToRerank: 100,\n      path: [\"description\", \"name\"]\n    }\n  },\n  {\n    $addFields: {\n      rerankScore: { $meta: \"score\" }\n    }\n  }\n]\n```\n",
      +            "items": {
      +              "anyOf": [
      +                {
      +                  "properties": {
      +                    "$vectorSearch": {
      +                      "anyOf": [
      +                        {
      +                          "description": "Classic vector search using 'queryVector'. Use this when the indexed field has a classic vector index (type: 'vector'). Note to LLM: Use the collection-indexes tool to verify the target field has a classic vector index before using 'queryVector'.",
      +                          "properties": {
      +                            "exact": {
      +                              "default": false,
      +                              "description": "When true, uses an ENN algorithm, otherwise uses ANN. Using ENN is not compatible with numCandidates, in that case, numCandidates must be left empty.",
      +                              "type": "boolean"
      +                            },
      +                            "filter": {
      +                              "additionalProperties": {},
      +                              "description": "MQL filter that can only use filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for filtering.",
      +                              "properties": {},
      +                              "type": "object"
      +                            },
      +                            "index": {
      +                              "description": "Name of the index, as retrieved from the `collection-indexes` tool.",
      +                              "type": "string"
      +                            },
      +                            "limit": {
      +                              "default": 10,
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "numCandidates": {
      +                              "description": "Number of candidates for the ANN algorithm. Mandatory when exact is false.",
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "path": {
      +                              "description": "Field, in dot notation, where to search. There must be a vector search index for that field.",
      +                              "type": "string"
      +                            },
      +                            "queryVector": {
      +                              "description": "The vector embeddings to search for when using classic vector search indexes (type: 'vector'). Provide embeddings as an array of numbers. Use this for classic vector indexes. For auto-embed indexes (type: 'autoEmbed'), use 'query' instead.",
      +                              "items": {
      +                                "type": "number"
      +                              },
      +                              "type": "array"
      +                            }
      +                          },
      +                          "required": [
      +                            "index",
      +                            "path",
      +                            "queryVector"
      +                          ],
      +                          "type": "object"
      +                        },
      +                        {
      +                          "description": "Auto-embed vector search using 'query'. Use this when the indexed field has an auto-embed index (type: 'autoEmbed'). Note to LLM: Use the collection-indexes tool to verify the target field has an auto-embed index before using 'query'.",
      +                          "properties": {
      +                            "exact": {
      +                              "default": false,
      +                              "description": "When true, uses an ENN algorithm, otherwise uses ANN. Using ENN is not compatible with numCandidates, in that case, numCandidates must be left empty.",
      +                              "type": "boolean"
      +                            },
      +                            "filter": {
      +                              "additionalProperties": {},
      +                              "description": "MQL filter that can only use filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for filtering.",
      +                              "properties": {},
      +                              "type": "object"
      +                            },
      +                            "index": {
      +                              "description": "Name of the index, as retrieved from the `collection-indexes` tool.",
      +                              "type": "string"
      +                            },
      +                            "limit": {
      +                              "default": 10,
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "model": {
      +                              "description": "The embedding model to use for generating embeddings from the query text. If not specified, defaults to the model configured in the auto-embed index definition.",
      +                              "enum": [
      +                                "voyage-4",
      +                                "voyage-4-large",
      +                                "voyage-4-lite",
      +                                "voyage-code-3"
      +                              ],
      +                              "type": "string"
      +                            },
      +                            "numCandidates": {
      +                              "description": "Number of candidates for the ANN algorithm. Mandatory when exact is false.",
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "path": {
      +                              "description": "Field, in dot notation, where to search. There must be a vector search index for that field.",
      +                              "type": "string"
      +                            },
      +                            "query": {
      +                              "description": "The query to search for when using auto-embed indexes (type: 'autoEmbed'). MongoDB will automatically generate embeddings for the text at query time. Use this for auto-embed indexes, not 'queryVector'.",
      +                              "properties": {
      +                                "text": {
      +                                  "description": "The text query to search for.",
      +                                  "type": "string"
      +                                }
      +                              },
      +                              "required": [
      +                                "text"
      +                              ],
      +                              "type": "object"
      +                            }
      +                          },
      +                          "required": [
      +                            "index",
      +                            "path",
      +                            "query"
      +                          ],
      +                          "type": "object"
      +                        }
      +                      ]
      +                    }
      +                  },
      +                  "required": [
      +                    "$vectorSearch"
      +                  ],
      +                  "type": "object"
      +                },
      +                {
      +                  "additionalProperties": {},
      +                  "properties": {},
      +                  "type": "object"
      +                }
      +              ]
      +            },
      +            "type": "array"
      +          }
      +        },
      +        "required": [
      +          "pipeline"
      +        ],
      +        "type": "object"
      +      },
      +      "name": {
      +        "const": "aggregate",
      +        "description": "The literal name 'aggregate' to represent an aggregation cursor as target.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "arguments"
      +    ],
      +    "type": "object"
      +  }
      +]
    • changedInput schema / required
      Previous value: -[
      -  "database",
      -  "collection",
      -  "exportTitle",
      -  "exportTarget"
      -]New value: +[
      +  "connectionId",
      +  "database",
      +  "collection",
      +  "exportTitle",
      +  "exportTarget"
      +]
  2. Changed3 schema fields changedv1.11.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • removedInput schema / properties / exportTarget / items / anyOf
      Removed value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "arguments": {
      -        "additionalProperties": false,
      -        "description": "The arguments for 'find' operation.",
      -        "properties": {
      -          "filter": {
      -            "additionalProperties": true,
      -            "description": "The query filter, matching the syntax of the query argument of db.collection.find()",
      -            "properties": {},
      -            "type": "object"
      -          },
      -          "limit": {
      -            "type": "number"
      -          },
      -          "projection": {
      -            "additionalProperties": true,
      -            "description": "The projection, matching the syntax of the projection argument of db.collection.find()",
      -            "properties": {},
      -            "type": "object"
      -          },
      -          "responseBytesLimit": {
      -            "default": 1048576,
      -            "description": "The maximum number of bytes to return in the response. This value is capped by the server's configured maxBytesPerQuery and cannot be exceeded. Note to LLM: If the entire query result is required, use the \"export\" tool instead of increasing this limit.",
      -            "type": "number"
      -          },
      -          "sort": {
      -            "additionalProperties": {},
      -            "description": "A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for ascending, -1 for descending).",
      -            "properties": {},
      -            "type": "object"
      -          }
      -        },
      -        "type": "object"
      -      },
      -      "name": {
      -        "const": "find",
      -        "description": "The literal name 'find' to represent a find cursor as target.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "name",
      -      "arguments"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "arguments": {
      -        "additionalProperties": false,
      -        "description": "The arguments for 'aggregate' operation.",
      -        "properties": {
      -          "pipeline": {
      -            "description": "An array of aggregation stages to execute.",
      -            "items": {
      -              "additionalProperties": true,
      -              "properties": {},
      -              "type": "object"
      -            },
      -            "type": "array"
      -          },
      -          "responseBytesLimit": {
      -            "default": 1048576,
      -            "description": "The maximum number of bytes to return in the response. This value is capped by the server's configured maxBytesPerQuery and cannot be exceeded. Note to LLM: If the entire aggregation result is required, use the \"export\" tool instead of increasing this limit.",
      -            "type": "number"
      -          }
      -        },
      -        "required": [
      -          "pipeline"
      -        ],
      -        "type": "object"
      -      },
      -      "name": {
      -        "const": "aggregate",
      -        "description": "The literal name 'aggregate' to represent an aggregation cursor as target.",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "name",
      -      "arguments"
      -    ],
      -    "type": "object"
      -  }
      -]
    • addedInput schema / properties / exportTarget / items / oneOf
      Added value: +[
      +  {
      +    "properties": {
      +      "arguments": {
      +        "description": "The arguments for 'find' operation.",
      +        "properties": {
      +          "filter": {
      +            "additionalProperties": {},
      +            "description": "The query filter, matching the syntax of the query argument of db.collection.find()",
      +            "properties": {},
      +            "type": "object"
      +          },
      +          "limit": {
      +            "type": "number"
      +          },
      +          "projection": {
      +            "additionalProperties": {},
      +            "description": "The projection, matching the syntax of the projection argument of db.collection.find()",
      +            "properties": {},
      +            "type": "object"
      +          },
      +          "sort": {
      +            "additionalProperties": {
      +              "anyOf": [
      +                {
      +                  "const": 1,
      +                  "type": "number"
      +                },
      +                {
      +                  "const": -1,
      +                  "type": "number"
      +                },
      +                {
      +                  "const": "asc",
      +                  "type": "string"
      +                },
      +                {
      +                  "const": "desc",
      +                  "type": "string"
      +                },
      +                {
      +                  "const": "ascending",
      +                  "type": "string"
      +                },
      +                {
      +                  "const": "descending",
      +                  "type": "string"
      +                },
      +                {
      +                  "properties": {
      +                    "$meta": {
      +                      "type": "string"
      +                    }
      +                  },
      +                  "required": [
      +                    "$meta"
      +                  ],
      +                  "type": "object"
      +                }
      +              ],
      +              "description": "The sort key and its direction"
      +            },
      +            "description": "A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for ascending, -1 for descending).",
      +            "propertyNames": {
      +              "type": "string"
      +            },
      +            "type": "object"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "name": {
      +        "const": "find",
      +        "description": "The literal name 'find' to represent a find cursor as target.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "arguments"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "arguments": {
      +        "description": "The arguments for 'aggregate' operation.",
      +        "properties": {
      +          "pipeline": {
      +            "description": "An array of aggregation stages to execute.\nIf the user has asked for a vector search, `$vectorSearch` **MUST** be the first stage of the pipeline, or the first stage of a `$unionWith` subpipeline.\nIf the user has asked for lexical/Atlas search, use `$search` instead of `$text`.\n### Usage Rules for `$vectorSearch`\n- **Index Type Detection:**\n  Use the collection-indexes tool to determine if the target field has a classic vector index (type: 'vector') or an auto-embed index (type: 'autoEmbed').\n- **Classic Vector Search (type: 'vector'):**\n  Use 'queryVector' with embeddings as an array of numbers.\n- **Auto-Embed Vector Search (type: 'autoEmbed'):**\n  Use 'query' - MongoDB automatically generates embeddings at query time. Do NOT use 'queryVector' or 'embeddingParameters' for auto-embed indexes.\n- **Unset embeddings:**\n  Unless the user explicitly requests the embeddings, add an `$unset` stage **at the end of the pipeline** to remove the embedding field and avoid context limits. **The $unset stage in this situation is mandatory**.\n- **Pre-filtering:**\n  If the user requests additional filtering, include filters in `$vectorSearch.filter` only for pre-filter fields in the vector index.\n  NEVER include fields in $vectorSearch.filter that are not part of the vector index.\n- **Post-filtering:**\n  For all remaining filters, add a $match stage after $vectorSearch.\n- If unsure which fields are filterable, use the collection-indexes tool to determine valid prefilter fields.\n- If no requested filters are valid prefilters, omit the filter key from $vectorSearch.\n\n### Usage Rules for `$search`\n- Include the index name, unless you know for a fact there's a default index. If unsure, use the collection-indexes tool to determine the index name.\n- The `$search` stage supports multiple operators, such as 'autocomplete', 'text', 'geoWithin', and others. Choose the approprate operator based on the user's query. If unsure of the exact syntax, consult the MongoDB Atlas Search documentation, which can be found here: https://www.mongodb.com/docs/atlas/atlas-search/operators-and-collectors/\n",
      +            "items": {
      +              "anyOf": [
      +                {
      +                  "properties": {
      +                    "$vectorSearch": {
      +                      "anyOf": [
      +                        {
      +                          "description": "Classic vector search using 'queryVector'. Use this when the indexed field has a classic vector index (type: 'vector'). Note to LLM: Use the collection-indexes tool to verify the target field has a classic vector index before using 'queryVector'.",
      +                          "properties": {
      +                            "exact": {
      +                              "default": false,
      +                              "description": "When true, uses an ENN algorithm, otherwise uses ANN. Using ENN is not compatible with numCandidates, in that case, numCandidates must be left empty.",
      +                              "type": "boolean"
      +                            },
      +                            "filter": {
      +                              "additionalProperties": {},
      +                              "description": "MQL filter that can only use filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for filtering.",
      +                              "properties": {},
      +                              "type": "object"
      +                            },
      +                            "index": {
      +                              "description": "Name of the index, as retrieved from the `collection-indexes` tool.",
      +                              "type": "string"
      +                            },
      +                            "limit": {
      +                              "default": 10,
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "numCandidates": {
      +                              "description": "Number of candidates for the ANN algorithm. Mandatory when exact is false.",
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "path": {
      +                              "description": "Field, in dot notation, where to search. There must be a vector search index for that field.",
      +                              "type": "string"
      +                            },
      +                            "queryVector": {
      +                              "description": "The vector embeddings to search for when using classic vector search indexes (type: 'vector'). Provide embeddings as an array of numbers. Use this for classic vector indexes. For auto-embed indexes (type: 'autoEmbed'), use 'query' instead.",
      +                              "items": {
      +                                "type": "number"
      +                              },
      +                              "type": "array"
      +                            }
      +                          },
      +                          "required": [
      +                            "index",
      +                            "path",
      +                            "queryVector"
      +                          ],
      +                          "type": "object"
      +                        },
      +                        {
      +                          "description": "Auto-embed vector search using 'query'. Use this when the indexed field has an auto-embed index (type: 'autoEmbed'). Note to LLM: Use the collection-indexes tool to verify the target field has an auto-embed index before using 'query'.",
      +                          "properties": {
      +                            "exact": {
      +                              "default": false,
      +                              "description": "When true, uses an ENN algorithm, otherwise uses ANN. Using ENN is not compatible with numCandidates, in that case, numCandidates must be left empty.",
      +                              "type": "boolean"
      +                            },
      +                            "filter": {
      +                              "additionalProperties": {},
      +                              "description": "MQL filter that can only use filter fields from the index definition. Note to LLM: If unsure, use the `collection-indexes` tool to learn which fields can be used for filtering.",
      +                              "properties": {},
      +                              "type": "object"
      +                            },
      +                            "index": {
      +                              "description": "Name of the index, as retrieved from the `collection-indexes` tool.",
      +                              "type": "string"
      +                            },
      +                            "limit": {
      +                              "default": 10,
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "model": {
      +                              "description": "The embedding model to use for generating embeddings from the query text. If not specified, defaults to the model configured in the auto-embed index definition.",
      +                              "enum": [
      +                                "voyage-4",
      +                                "voyage-4-large",
      +                                "voyage-4-lite",
      +                                "voyage-code-3"
      +                              ],
      +                              "type": "string"
      +                            },
      +                            "numCandidates": {
      +                              "description": "Number of candidates for the ANN algorithm. Mandatory when exact is false.",
      +                              "exclusiveMinimum": 0,
      +                              "maximum": 9007199254740991,
      +                              "type": "integer"
      +                            },
      +                            "path": {
      +                              "description": "Field, in dot notation, where to search. There must be a vector search index for that field.",
      +                              "type": "string"
      +                            },
      +                            "query": {
      +                              "description": "The query to search for when using auto-embed indexes (type: 'autoEmbed'). MongoDB will automatically generate embeddings for the text at query time. Use this for auto-embed indexes, not 'queryVector'.",
      +                              "properties": {
      +                                "text": {
      +                                  "description": "The text query to search for.",
      +                                  "type": "string"
      +                                }
      +                              },
      +                              "required": [
      +                                "text"
      +                              ],
      +                              "type": "object"
      +                            }
      +                          },
      +                          "required": [
      +                            "index",
      +                            "path",
      +                            "query"
      +                          ],
      +                          "type": "object"
      +                        }
      +                      ]
      +                    }
      +                  },
      +                  "required": [
      +                    "$vectorSearch"
      +                  ],
      +                  "type": "object"
      +                },
      +                {
      +                  "additionalProperties": {},
      +                  "properties": {},
      +                  "type": "object"
      +                }
      +              ]
      +            },
      +            "type": "array"
      +          }
      +        },
      +        "required": [
      +          "pipeline"
      +        ],
      +        "type": "object"
      +      },
      +      "name": {
      +        "const": "aggregate",
      +        "description": "The literal name 'aggregate' to represent an aggregation cursor as target.",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name",
      +      "arguments"
      +    ],
      +    "type": "object"
      +  }
      +]
  3. Changed6 schema fields changedv1.0.0
    • addedInput schema / properties / exportTarget
      Added value: +{
      +  "description": "The export target along with its arguments.",
      +  "items": {
      +    "anyOf": [
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "arguments": {
      +            "additionalProperties": false,
      +            "description": "The arguments for 'find' operation.",
      +            "properties": {
      +              "filter": {
      +                "additionalProperties": true,
      +                "description": "The query filter, matching the syntax of the query argument of db.collection.find()",
      +                "properties": {},
      +                "type": "object"
      +              },
      +              "limit": {
      +                "type": "number"
      +              },
      +              "projection": {
      +                "additionalProperties": true,
      +                "description": "The projection, matching the syntax of the projection argument of db.collection.find()",
      +                "properties": {},
      +                "type": "object"
      +              },
      +              "responseBytesLimit": {
      +                "default": 1048576,
      +                "description": "The maximum number of bytes to return in the response. This value is capped by the server's configured maxBytesPerQuery and cannot be exceeded. Note to LLM: If the entire query result is required, use the \"export\" tool instead of increasing this limit.",
      +                "type": "number"
      +              },
      +              "sort": {
      +                "additionalProperties": {},
      +                "description": "A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for ascending, -1 for descending).",
      +                "properties": {},
      +                "type": "object"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "name": {
      +            "const": "find",
      +            "description": "The literal name 'find' to represent a find cursor as target.",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "name",
      +          "arguments"
      +        ],
      +        "type": "object"
      +      },
      +      {
      +        "additionalProperties": false,
      +        "properties": {
      +          "arguments": {
      +            "additionalProperties": false,
      +            "description": "The arguments for 'aggregate' operation.",
      +            "properties": {
      +              "pipeline": {
      +                "description": "An array of aggregation stages to execute.",
      +                "items": {
      +                  "additionalProperties": true,
      +                  "properties": {},
      +                  "type": "object"
      +                },
      +                "type": "array"
      +              },
      +              "responseBytesLimit": {
      +                "default": 1048576,
      +                "description": "The maximum number of bytes to return in the response. This value is capped by the server's configured maxBytesPerQuery and cannot be exceeded. Note to LLM: If the entire aggregation result is required, use the \"export\" tool instead of increasing this limit.",
      +                "type": "number"
      +              }
      +            },
      +            "required": [
      +              "pipeline"
      +            ],
      +            "type": "object"
      +          },
      +          "name": {
      +            "const": "aggregate",
      +            "description": "The literal name 'aggregate' to represent an aggregation cursor as target.",
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "name",
      +          "arguments"
      +        ],
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  "type": "array"
      +}
    • removedInput schema / properties / filter
      Removed value: -{
      -  "additionalProperties": true,
      -  "description": "The query filter, matching the syntax of the query argument of db.collection.find()",
      -  "properties": {},
      -  "type": "object"
      -}
    • removedInput schema / properties / limit
      Removed value: -{
      -  "description": "The maximum number of documents to return",
      -  "type": "number"
      -}
    • removedInput schema / properties / projection
      Removed value: -{
      -  "additionalProperties": true,
      -  "description": "The projection, matching the syntax of the projection argument of db.collection.find()",
      -  "properties": {},
      -  "type": "object"
      -}
    • removedInput schema / properties / sort
      Removed value: -{
      -  "additionalProperties": {},
      -  "description": "A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for ascending, -1 for descending).",
      -  "properties": {},
      -  "type": "object"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "exportTitle",
      -  "database",
      -  "collection"
      -]New value: +[
      +  "database",
      +  "collection",
      +  "exportTitle",
      +  "exportTarget"
      +]
  4. First observed

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, so the safety profile is covered. The description adds the EJSON format context, but it does not disclose what happens during export (e.g., whether results are returned as files, streamed, or stored) or any other behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single front-loaded sentence with zero filler. It states the core function immediately and does not waste words, making it highly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has a complex exportTarget parameter and no output schema, yet the description is only one sentence. It does not explain the export flow or return value (e.g., whether the tool returns a file, job ID, or stream URI), which is a significant gap given the tool's complexity and the absence of an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with detailed descriptions for all six parameters including the complex exportTarget structure. The description only mentions 'EJSON format', which is already captured by the jsonExportFormat parameter, so it adds no additional parameter-level meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Export' and names the resource ('query or aggregation results') and the target format ('EJSON'), clearly distinguishing this tool from read-only siblings like find and aggregate. It immediately tells the agent what function the tool performs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The sentence implies the tool is for exporting query/aggregation results, but it gives no explicit guidance on when to prefer this over alternatives such as find/aggregate, nor any prerequisites or exclusions. The use case is inferable but not elaborated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mongodb-js/mongodb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server