Validate a SQL query against the ontology
validate_sqlValidates a single read-only SELECT query before execution by checking permissions, table and column names, joins, scale mismatches, and fan-out, then running a database dry run.
Instructions
Validate a single SELECT query without returning rows: enforces the read-only guard, checks table/column names, verifies joins and default roles, flags near-miss literals, percent-vs-fraction scale mismatches, and one-to-many fan-out under aggregations, and runs a database dry run. Always call before run_sql and pass question when percentages appear; use run_sql only after fixing every reported error. Returns ok, errors, warnings, and the draft/certified status of relied-on Terms.
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": "validate_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Single read-only SELECT statement in the datasource's SQL dialect. | |
| question | No | User question; percentages mentioned in it are checked against the numeric scale of filtered columns. | |
| datasource | No | Datasource name. Optional when only one datasource is registered. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||