sql-query
Run a read-only PostgreSQL query (SELECT only) on the tables of one project. Use it for counts, sums, grouping and reads that join several tables.
Use database names, not display names or IDs:
Table: the dbTableName from get-tables-meta, already in "schema.table" form; quote each part, e.g. FROM "bseXXX"."tblYYY"
Column: the dbFieldName from get-fields, in double quotes, e.g. "Status"
System columns: "__id", "__auto_number", "__created_time", "__last_modified_time", "__created_by", "__last_modified_by"
Add LIMIT 100 to queries that return rows. Timestamps are stored in UTC; convert with timezone('Asia/Shanghai', "col") when needed.
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": {
"sql": "<sql>",
"baseId": "<baseId>"
},
"name": "sql-query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL query to execute (SELECT only) | |
| baseId | Yes | The project (base) ID, e.g. "bseXXXXXXXX". Use list-bases to find it. |