Run a Read-Only SQL Query
link_queryRuns one read-only SQL query across datasets, for analysis the per-dataset filters cannot express, such as joining education, Census, immigration, or health figures to a lookup table or to each other on shared geography (immigration, county-level Census, and health data share county_fips; Census and health tract data share tract_geoid). The dialect is DuckDB SQL (https://duckdb.org/docs/sql/introduction). Allowed: one SELECT (or WITH ... SELECT) that names only the tables link_tables lists, by their table names (FROM education.attendance a JOIN dimensions.districts d ON a.district_code = d.district_code; without an alias a table is referenced by its bare name, 'attendance'); no DDL, DML, COPY, ATTACH, INSTALL, PRAGMA, SET, or CALL, and no read_parquet(), other file readers, or file paths. Joins use the keys from describe_dimension's link_keys (districts.district_census_id reaches Census data through the crosswalk; it is a school-district code, not a county FIPS code, and a district is not the same as a county). Results are capped by rows, bytes, and time; truncated says a cap was hit, and grouping or a tighter WHERE fits more. NULL means suppressed, not zero. A rejected query returns an error naming the token or table at fault, with the closest table names.
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": "link_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One DuckDB SELECT statement over link_tables' table names, e.g. 'SELECT ... FROM education.attendance'. | |
| limit | No | Most rows to return (default 100, at most 500). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||