Skip to main content
Glama
Firenook

Firenook

Official

firestore_count

Read-onlyIdempotent

Count Firestore documents in a collection or collection group that match optional AND filters using COUNT aggregation, without reading documents back.

Instructions

Count the documents of a collection, or with collectionGroup of every collection with that id, that match optional where filters (a COUNT aggregation; no documents are read back).

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>"
    },
    "name": "firestore_count"
  }
}

Input Schema

NameRequiredDescriptionDefault
whereNoFilters combined with AND
databaseNoFirestore database id; default (default)
collectionYesCollection path, or a collection id with collectionGroup
collectionGroupNoCollection-group query: every collection with the last segment's id at any depth under the parent (the database root for a bare id, e.g. posts; users/alice/posts for one document's descendants)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare read-only, idempotent, non-destructive, closed-world behavior, so the description only needs to add beyond that; it does add valuable context that this is a COUNT aggregation with no document reads. However, it omits operationally important behavior such as whether filtered counts may require a composite index (relevant given the firestore_missing_indexes sibling) and what the response contains.

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

Conciseness4/5

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

A single front-loaded sentence that covers the core action, the collectionGroup variant, and the filters without filler. It is dense but every clause carries information; only slightly convoluted phrasing keeps it from a 5.

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 no output schema, the description should say what comes back (a document count), which is only implied by 'Count the documents'. It also leaves out index/permission prerequisites for filtered counts, which matters for a complex-ish 4-parameter aggregation tool.

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%, so the baseline is 3. The description does reinforce the semantics of 'collection' plus 'collectionGroup' and the optional where filters combined with AND, but adds no format or constraint detail beyond what the schema already states.

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 uses a specific verb (count) and resource (documents of a collection, or collection groups), and explicitly labels the operation a COUNT aggregation that reads no documents back, which separates it in spirit from firestore_query/firestore_get. It does not name any sibling outright, keeping it just short of a 5.

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?

Usage is implied by 'no documents are read back', which suggests this is the tool for cardinality rather than data retrieval, but there is no explicit when-to-use / when-not guidance and no named alternative for fetching the actual documents. An agent must infer the routing decision.

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