Skip to main content
Glama

Count records

count_data
Read-onlyIdempotent

Count records in a table with an optional WHERE condition (SELECT COUNT(*)). Returns the record count without reading any data. Change history tables (with the _history suffix) can be counted as well.

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": {
      "table": "<table>"
    },
    "name": "count_data"
  }
}

Input Schema

NameRequiredDescriptionDefault
tableYesTable name, e.g. ng_invoice.
conditionsNoOptional WHERE condition (without the WHERE keyword). String values use plain single quotes ('Active'); write dates between # # (e.g. #2026-01-01#). Subqueries are not allowed. Example: ng_amount > 1000 AND ng_status = 'Active' AND ng_datum >= #2026-01-01#.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already establish read-only, idempotent, closed-world, non-destructive behavior, so the description only needs to add context. It does add real value by disclosing the efficiency trait ('without reading any data') and that history-suffixed tables are in scope, though it says nothing about permissions, cost limits, or what happens with invalid conditions.

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?

Three short sentences, front-loaded with the core action and scope, with no filler. The parenthetical SELECT COUNT(*) is mildly redundant but useful for understanding the mechanism, so nothing is wasted.

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?

This is a simple two-parameter read tool with rich annotations and full schema coverage, and the description covers action, scope, mechanism, and return meaning ('Returns the record count'). The only gap is sibling differentiation against get_record_counts, which is a routing concern rather than a completeness one.

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 coverage is 100%, so the schema already documents both parameters in depth (quoting rules, date literals, subquery prohibition, example). The description reinforces the optional WHERE clause and adds the history-table naming convention, but adds little syntactic meaning beyond the schema — the baseline 3 applies.

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 names a specific verb and resource ('Count records in a table') and pins down the mechanism (SELECT COUNT(*)), plus an extra scope note that _history tables are countable. It does not differentiate itself from the sibling get_record_counts, so an agent cannot tell the two apart from this text alone.

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 only implied: 'Returns the record count without reading any data' hints that this should be preferred over read_data when only a tally is needed, but it never states when to use it versus get_record_counts or read_data explicitly. No exclusions or prerequisites are given.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources