Execute a read-only SQL query
run_sqlRuns a validated, single read-only SELECT against a registered datasource and returns rows, columns, term status, and warnings; blocks writes, DDL, multiple statements, and uncataloged tables.
Instructions
Execute one read-only SELECT query against a registered datasource and return columns, rows, row_count, truncated flag, relied-on Terms (with draft/certified status), and warnings. Call after validate_sql passes; use lookup_values to inspect single-column values instead. Refuses writes, DDL, multiple statements, and uncataloged tables on a read-only connection, and logs the query with question for provenance.
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_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Single read-only SELECT statement in the datasource's SQL dialect. | |
| max_rows | No | Maximum rows to return (>= 1; capped by the server's AUTO_ONTOLOGY_MAX_ROWS limit). | |
| question | No | User question logged with the query for provenance and used to check percent-vs-fraction thresholds. | |
| datasource | No | Datasource name. Optional when only one datasource is registered. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||