check_sql
Lint SQL against the semantic layer before execution to catch unknown tables/columns, deprecated tables, missing filters, and unsafe joins that return wrong numbers instead of errors.
Instructions
Lint SQL against the semantic layer BEFORE it runs ANYWHERE.
Including SQL you intend to execute with a tool that is not
semlayer's. Deterministic checks: unknown tables/columns, correlated
references, deprecated tables, missing required filters, fan-out
aggregates, SCD2 joins without a validity window. These are the
mistakes that return a NUMBER rather than an error, so an unchecked
statement can be confidently wrong. Fix every error and warning
(each finding carries a fix hint), then re-check. Cheap,
deterministic, and it never touches the warehouse.
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": "check_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The statement to check, exactly as it would be run. | |
| dialect | No | The SQL dialect the statement is written in, by its sqlglot name: `duckdb`, `snowflake`, `bigquery`, `postgres`. An unknown name is reported as a finding. | duckdb |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |