table_sql
Execute a read-only SQL query against the workspace data tables.
The query runs inside the workspace's PostgreSQL schema, so you can reference table names directly (e.g., SELECT * FROM invoices).
Supports JOINs, sub-selects, read-only CTEs (WITH ... SELECT), aggregations, and window functions. Only a single SELECT or EXPLAIN SELECT is allowed, and it may only reference this workspace's tables — other schemas, system catalogs and system/admin functions are rejected. Use table_sql_execute for writes.
Results are capped server-side at 1000 rows regardless
of the query — use limit (default 50, max
1000) to request fewer, and add your own ORDER BY for a
deterministic top-N.
Parameters use $1, $2, etc. placeholders.
Fields are "query", "params" (a JSON string) and "limit". Example: {"query":"SELECT * FROM invoices WHERE status = $1","params":"["open"]","limit":20}
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": {
"query": "<query>"
},
"name": "table_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows to return (default 50, max 1000). Ignored for EXPLAIN. | |
| query | Yes | SQL SELECT query to execute | |
| params | No | JSON array of parameter values for $1, $2, etc. placeholders |