query_layer
Query a layer's data with filters and grouping. Reads the parquet file at runtime. Supports: select specific columns, filter by column values, group by a column to get counts, and sum numeric columns per group (e.g. roll block areas up to district totals). Use get_layer_schema first to discover column names. Examples: 'airports in Karnataka' -> where: {state: 'KA'}, 'forest types' -> group_by: 'type', 'health facilities in Bihar' -> where: {state: 'BIHAR'}, select: ['name', 'type'].
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": {
"layer_id": "<layer_id>"
},
"name": "query_layer"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sum | No | Numeric columns to total per group (requires group_by). Adds {sums: {group: {col: total}}}. Use this to roll finer units up, e.g. block-level areas to district totals. Shares/percentages are not additive: sum the area columns and recompute shares. | |
| limit | No | Max rows (default 100, max 1000) | |
| where | No | Filter conditions as {column: value} pairs. Exact, case-insensitive match on flat columns (not partial). Values may contain commas. | |
| select | No | Column names to return. Omit for all non-geometry columns. | |
| group_by | No | Column to group by. Returns {value: count} instead of rows. | |
| layer_id | Yes | Layer ID to query | |
| include_centroid | No | Include _lat/_lng centroid coordinates (defaults to true). Set false to exclude. |