Count rows
countCalculates the number of rows in a table matching filters, optionally grouped by distinct values to reveal data distribution.
Instructions
Counts the rows in a table that match a filter. With groupBy, counts per distinct value, largest groups first: a quick way to see how data is distributed.
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"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | The table: its TypeScript export or SQL name. | |
| where | No | Conditions that must all hold, keyed by column (TypeScript key or SQL name). A plain value means equals: {"published": true}. Operators: {"createdAt": {"gte": "2026-01-01"}}, {"title": {"ilike": "%drizzle%"}}, {"id": {"in": [1, 2]}}, {"deletedAt": {"isNull": true}}. Use {"or": [{...}, {...}]} for alternatives. | |
| groupBy | No | Columns to count per value of, such as ["status"]. |