Skip to main content
Glama

Count MongoDB documents

mongo_count_documents
Read-onlyIdempotent

Count documents in a MongoDB collection that match a filter within a bounded execution time. Read-only, for query result totals.

Instructions

Count documents matching a MongoDB filter with a bounded max execution time. This tool is read-only in every environment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNo
collectionYes
timeout_msNo
connection_idYes
response_formatNomarkdown

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0-alpha.1

TDQS

B3.1/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false; the description reinforces read-only status and adds a useful 'bounded max execution time' note. However, it doesn't say what happens when the time bound is exceeded or what auth scope is needed, so it goes only modestly beyond the 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?

Two tight sentences with no waste, front-loading the core action before the safety note. Nothing is padded or redundant.

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

Completeness3/5

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

With 5 parameters, 0% schema coverage, and no output schema, the description is thin: it omits the required connection_id/collection semantics, the response_format enum, and any return-value characterization. Annotations cover the safety profile, but the parameter story is incomplete.

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

Parameters2/5

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

Schema description coverage is 0% across 5 parameters, so the description carries the full burden. It only hints at the filter and timeout (via 'matching a MongoDB filter' and 'bounded max execution time'), leaving connection_id, collection, and response_format entirely unexplained.

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?

States a precise verb+resource: counting documents matching a MongoDB filter. Clear what the tool returns, but it never distinguishes itself from siblings like mongo_find or mongo_aggregate, which an agent must choose between.

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

Usage Guidelines2/5

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

There is no when-to-use or when-not-to-use guidance, and no mention of alternatives such as mongo_find. Nothing tells the agent why it would count rather than fetch or aggregate.

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