count_rows
Count rows in a PostgreSQL table with an optional WHERE filter. Returns an exact count without row data.
Instructions
Count rows in a PostgreSQL table, optionally filtered by a WHERE clause.
Exact, unlike the estimates from list_tables, and returns no row data.
Args: table: Table name. where: Optional WHERE clause body without the WHERE keyword, e.g. "status = 'active'". schema: Schema name. Defaults to the session schema, then 'public'. database: Database name. Defaults to the session database.
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_rows"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| where | No | ||
| schema | No | ||
| database | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |