Skip to main content
Glama
Vijayakumar-DevOps

MongoDB MCP Server

count

Read-only

Count documents in a MongoDB collection using db.collection.count(), with an optional query filter to count only matching documents.

Instructions

Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter parameter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoA filter/query parameter. Allows users to filter the documents to count. Matches the syntax of the filter argument of db.collection.count().
databaseYesDatabase name
collectionYesCollection name

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
countYesThe number of documents in the collection
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, establishing safety. The description adds that it uses db.collection.count() and that query is optional, which clarifies the operation. However, it does not disclose potential nuances such as exact vs. estimated counts, performance implications, or behavior with large collections, so it adds only minor context beyond annotations.

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?

The description is a single, concise sentence that front-loads the primary purpose and includes the method name. Every word adds value, with no redundancy or extraneous detail.

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

Completeness4/5

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

For a straightforward counting tool with an output schema present, the description covers the essential functionality and optional filtering. It does not explain return values, but the output schema likely handles that. It could mention performance limitations or distinction from similar tools, but given the tool's simplicity, the description is sufficiently complete.

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?

The input schema already provides 100% coverage with clear descriptions for database, collection, and query. The description mentions query as an optional filter and relates it to the syntax of db.collection.count(). This slightly reinforces the schema but does not add substantial new meaning beyond what is already present.

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

Purpose4/5

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

The description clearly states the tool's function: 'Gets the number of documents in a MongoDB collection' with a specific verb and resource. It also names the underlying method (db.collection.count()), which adds precision. However, it does not explicitly distinguish this tool from siblings like aggregate or find, which can also return counts.

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 description mentions that query is an optional filter parameter, implying the tool is used to count filtered documents. It does not provide explicit guidance on when to choose this over alternatives (e.g., find or aggregate), nor does it state exclusions or prerequisites. The usage context is present but not fully developed.

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

Install Server

Other Tools

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/Vijayakumar-DevOps/mongo-mcp-1.14.0'

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