Run read-only query
run_queryExecutes a single read-only SQL statement (SELECT/WITH/SHOW) inside a rolled-back transaction, with $1 placeholders and row caps, so agents can inspect data without writes.
Instructions
Run one SELECT / WITH / VALUES / TABLE / SHOW statement inside a READ ONLY transaction that is always rolled back. Use $1, $2 … placeholders with params for values. Results are capped at POSTGRES_MAX_ROWS. Refused while POSTGRES_SCHEMA_ALLOWLIST is set (free-form SQL can reach any schema) — use select_rows then.
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>"
},
"name": "run_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single read statement, e.g. SELECT id, total FROM orders WHERE status = $1 | |
| params | No | Values for $1, $2 … placeholders |