query_sql
Run a single SQL statement in a read-only transaction to inspect data safely. Returns up to 1,000 rows, caps output at 1 MB, and times out after 30 seconds.
Instructions
Runs one SQL statement in a read-only transaction, so it cannot change data. Returns at most 1,000 rows and 1,048,576 bytes. Times out after 30s.
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": {
"database": "<database>",
"sql": "<sql>"
},
"name": "query_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One SQL statement, sent to Postgres unchanged. More than one statement is refused. | |
| database | Yes | The database to run on. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | The result rows, each an array in column order. | |
| columns | Yes | The result columns, in order. | |
| truncated | Yes | True when the row cap, the byte cap or limit cut off more rows. |