Run read-only query
run_queryExecute read-only SQL statements (SELECT, WITH, EXPLAIN, SHOW) against the local Postgres database using optional parameters for safe data retrieval.
Instructions
Run a single read-only SQL statement (SELECT/WITH/EXPLAIN/SHOW). Executes inside a READ ONLY transaction. Use $1, $2… placeholders with params.
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-only SQL statement. | |
| limit | No | Max rows to return (default 500). | |
| params | No | Positional parameters for $1, $2, … |