MongoDB MCP server has reasonable parameter schema coverage and mostly clear descriptions, but suffers from several medium-severity issues: (1) Generic parameter names and descriptions that don't follow verb_noun conventions; (2) Missing output schema documentation, no caller-visible schema for what tools return; (3) Weak descriptions on some tools (e.g., 'List all available databases in the database' is circular); (4) Missing parameter descriptions on critical fields (indexSpec, pipeline, filter, update lack detail on format/constraints); (5) No error handling guidance or recovery hints in descriptions; (6) Destructive operations (deleteOne, dropIndex) lack confirmation or dry-run patterns. The tool set is well-structured with a clean BaseTool abstraction and consistent error handling at the implementation level, but the MCP-facing schemas and descriptions need strengthening for LLM selection and safe operation.
Tools (12)
aggregateread onlysource verified60/100
Execute a MongoDB aggregation pipeline
countread onlysource verified68/100
Count documents in a collection using MongoDB query syntax
createIndexwritesource verified62/100
Create a new index on a collection
deleteOnedestructivesource verified60/100
Delete a single document from a collection
dropIndexwritesource verified60/100
Drop an index from a collection
findread onlysource verified68/100
Query documents in a collection using MongoDB query syntax
listDatabases description is circular: 'List all available databases in the database', grammatically unclear and unhelpful to LLM selection. Should state what data is returned and when to use it before other discovery tools.
Missing or vague parameter descriptions for critical fields: 'filter', 'update', 'pipeline', and 'indexSpec' lack detail on expected format, constraints, or examples. LLMs cannot infer MongoDB query syntax from bare names. Should specify 'MongoDB query object with operators like {$eq, $gt, $in}' or link to MongoDB docs.
No output schema documented. Callers cannot see what fields tools return (e.g., does 'find' return {documents: [], count: N} or raw array?). Without output schemas, LLMs cannot plan downstream tool calls or extract chaining IDs. Pattern baseline: 100% of A+ tools document return types.
listDatabases
Recommendations
Rewrite tool descriptions to be LLM-optimized (50-200 chars): include WHAT it does, WHEN to use it, and WHAT it returns. Example: 'Find documents in a collection matching a MongoDB filter query. Returns matching documents up to limit. Use for data retrieval; see listCollections first if unsure of collection name.' Current description is 75 chars but lacks context.
Add output schema documentation to every tool. In the tool registry or tool definition, document the return shape. Example for find(): {type: 'object', properties: {documents: {type: 'array'}, count: {type: 'number'}, matchedCount: {type: 'number'}}}. This enables LLM chaining.
For 'filter', 'update', 'pipeline', and 'indexSpec' parameters, add format examples and operator hints in descriptions. Example: 'MongoDB query filter object (e.g., {name: {$eq: "John"}, age: {$gt: 30}}). Supports operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $exists. See MongoDB query docs for full syntax.'
Add 'database' parameter to createIndex, dropIndex, and indexes tools. Current implementation appears to use a global/default database context, but explicit database selection prevents ambiguity and matches find/count/insertOne patterns.
Fix aggregate tool: change 'pipeline' parameter type from 'string' to 'array'. Description should be 'MongoDB aggregation pipeline as an array of stage objects (e.g., [{$match: {status: "active"}}, {$group: {_id: "$category", count: {$sum: 1}}}])'.
Add error handling and recovery hints to all tool descriptions. Example for deleteOne: 'Deletes one document. If no matching document found, returns count: 0, verify filter matches your intent before retrying. This operation is irreversible.' Similar guidance for find (zero results), updateOne/updateMany (no matches).
Destructive operations (deleteOne, dropIndex) lack confirmation or dry-run safeguards. Agents make mistakes, a destructive tool should either require explicit confirmation or offer a preview before execution. Pattern: confirmation-request.
Error handling in tool descriptions provides no recovery guidance. When find() returns zero results or deleteOne() fails, the error text does not guide the LLM toward next steps. Pattern baseline: error responses must tell the LLM what to do next.
Missing database context for index tools: createIndex and dropIndex do not accept a 'database' parameter, only 'collection'. This forces LLMs to assume the active/default database, ambiguous and error-prone if multiple databases exist. Should accept both database and collection for clarity.
Pipeline parameter in aggregate tool is typed as 'string' with description 'array of JSON objects'. This is a type mismatch, pipeline should be 'array' or 'object' in schema, not 'string'. LLMs will be confused whether to pass a JSON string or an array.
Missing validation constraints in descriptions: 'limit' in find() has min/max (1-1000) in schema but no description of why or what happens if exceeded. 'projection' accepts any object but should document MongoDB projection syntax (1 to include, 0 to exclude). LLMs need explicit guidance.
find
Implement a dry-run or confirmation pattern for destructive tools (deleteOne, dropIndex). Either: (1) Add an optional 'dry_run' parameter that returns what would be deleted without executing, or (2) Require users to call a separate 'confirm_delete' tool after seeing the preview. Pattern: confirmation-request.
Add parameter descriptions for existing schema fields that lack them. Example for projection in find: 'MongoDB projection object. Use 1 to include a field, 0 to exclude. Example: {name: 1, email: 1, password: 0} returns name and email but not password.' Similar detail for filter, update, indexSpec.
Document pagination/limits clearly. find() and aggregate() currently cap at limit=1000 by default (find) or unlimited (aggregate). Add explicit description: 'Maximum 1000 documents returned. Results are not paginated; use $skip and $limit in pipeline for large datasets.' This prevents LLMs from expecting pagination that doesn't exist.
Add idempotence hints for multi-step operations. updateOne/updateMany are idempotent if the filter is stable, but LLMs don't know this. Add: 'This operation is idempotent, calling with the same filter and update parameters multiple times produces the same final state (safe to retry on transient failures).' Pattern: idempotent-operation.