Query
queryAnalyse many areas or schools with a JSON query (never SQL). kind='area' (default): level lsoa, msoa, lad or rgn; scope england, london, a region or typed area ids; filters by value {metric, min, max}, percentile in scope {metric, pct_min}, vs the scope's reference {metric, vs: above}, change over N years {metric, change: {years, min}}, places inside {places: {category, brand, min}} or within_m; sort by a metric, a group stat {stat: median, metric} or deviation; above the metric's carrier level rows are groups: each metric is the group's own figure (its own row where the metric holds one at the level: crime, crime-, green-share, gross-yield; official where the publisher gives the council's or region's; else the weighted mean of all its areas; items[].method says which), with median, p25-p75, best tenth, count and fit share of the passing areas when asked, and group_filters filter them. defs say what each metric measures and is not, with England and region refs. kind='school' ranks schools (phase, ofsted, measure, near). saved='metric:' or 'custom:' runs a named ranking (describe_data(kind: 'ranking')). Pages of 10 (next.release flags moved rows) and a CSV download link. A London-only metric with an England scope is the coverage error with a hint; people metrics (Census) are never filtered or ranked.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | [option] What the rows are. | area |
| page | No | [paging] Page; next gives the following one. | |
| sort | No | [sort] {metric, dir?} | {stat, metric, dir?} | {deviation: metric, dir?} | {standing: [metrics], dir?}. Default: the first filter's metric, better end first. One key: a list sorts by its first entry, the rest named in caveats. | |
| level | No | [option] Row level. Above the metrics' carrier, rows are groups: each metric is the group's own figure (official, else the weighted mean of all its rows; defs and items[].method say which), with fit counts, the best row and stats of the passing rows when asked. | |
| saved | No | [id] A named query: metric:<id>, custom:<preset>, lens:<preset>, school:<axis>; the other params refine it. | |
| scope | No | [scope] england | london | a region name | a typed area id | a list of up to 10 ids. Where rows come from, the reference and the ranking population. Default: what the service covers. | |
| fields | No | [select fields] Facts per row: metric ids, or group stats {stat, metric}. Default: the filter and sort metrics. | |
| intent | No | [input value] Optional, one to three sentences you write: what the user is looking for with this call and the criteria that matter, e.g. '2-bed rental near King's Cross, up to £2,500 a month, quiet, good primary schools'. Close Knit reads these to improve its answers. Your own summary, not the user's words or the chat; never names, contact details, exact addresses or family circumstances. | |
| period | No | [filter: exact] YYYY-MM; default each metric's latest. | |
| filters | No | [filter: range] Row conditions, ANDed: {metric, min?, max?} | {metric, pct_min?, pct_max?} | {metric, vs: above|below, ref?: scope|london|england, by?} | {metric, change: {years, min?, max?, unit?: abs|pct}} | {places: {category?, brand?, min?, max?, within_m?}} | {in: [ids]} | {not_in: [ids]} | {custom, min?, max?}. Schools: {phase} | {ofsted: [grades]} | {measure, min?, max?} | {near, within_m?}. | |
| release | No | [paging] From next.release: a caveat says if rows moved between pages. | |
| page_size | No | [paging] Rows per page, at most 50 (limit reads as page_size). | |
| standouts | No | [option] Groups: up to 3 best rows from groups not on the page. | |
| group_filters | No | [filter: range] Group conditions (HAVING): {stat: value|median|mean|p25|p75|best10|count|fit_share, metric?, min?, max?}; value is the group's own figure. | |
| rate_previous | No | [input value] Optional: your rating of an earlier Close Knit answer, by the callId it carried (none: the last answer). Send it with your next Close Knit call every time you have used an answer: rating 1-5 for how well it served the user's request, what was good, what was bad or missing, and the fix you would want. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||