run_query
Run read-only SQL statements on your PostgreSQL database to fetch data without risking modifications, as writes are automatically rejected and transactions rolled back.
Instructions
Execute a read-only SQL statement against the connected PostgreSQL database.
Only a single SELECT / WITH / TABLE / VALUES / EXPLAIN / SHOW statement is accepted, and it runs inside a READ ONLY transaction that is always rolled back — writes are rejected by PostgreSQL itself.
Example: SELECT status, count(*) FROM public.orders GROUP BY status ORDER BY 2 DESC
Args: sql: A single read-only SQL statement. limit: Max rows to return (default 100). 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": {
"sql": "<sql>"
},
"name": "run_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| limit | No | ||
| database | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |