run_query
Execute read-only SQL queries against PostgreSQL or MySQL databases. Return columns, rows, and a markdown table, with preview mode to sanity-check results before a full run.
Instructions
Execute a READ-ONLY SQL query (SELECT/CTE/SHOW/DESCRIBE/EXPLAIN only — writes are rejected at multiple layers). Returns columns, rows, row_count, truncated flag, and a ready-to-display markdown_table. Set preview=true to sanity-check a few rows before a full run. An automatic LIMIT is applied to unbounded SELECTs.
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": {
"connection": "<connection>",
"sql": "<sql>"
},
"name": "run_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A single read-only SQL statement. | |
| limit | No | Max rows (default 100, hard cap 1000). | |
| preview | No | If true, return only 5 rows as a sanity check. | |
| connection | Yes | Named connection from list_connections (preferred) or a raw connection string. |