Query FEMA DataCanvas Table
fema_dataframe_queryQuery staged NFIP claims, PA projects, or housing records with read-only SQL. Use GROUP BY, SUM, or COUNT to aggregate staged records without re-fetching from the API. Call fema_dataframe_describe first to get the exact table name and column names needed for valid SQL. Read-only queries can inspect columns with SHOW and fill gaps with range() or generate_series() over constant arguments. DDL, DML, COPY, and file-reading functions are blocked. A response holds at most 100,000 characters of rows; when it holds fewer rows than the query returned, truncated and shown are set and the notice says how to page with OFFSET.
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": {
"canvas_id": "<canvas_id>",
"query": "<query>"
},
"name": "fema_dataframe_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | SQL SELECT statement to run against the staged table. Use the table name from fema_dataframe_describe. Results are capped at the canvas row limit and at 100,000 characters of rows; append LIMIT/OFFSET, under an ORDER BY, to page through additional rows, or aggregate (GROUP BY, COUNT, SUM) to summarize the full set in one query. Example: "SELECT year_of_loss, COUNT(*) AS claims, SUM(amount_paid_building) AS total_building_paid FROM df_nfip_abc123 GROUP BY year_of_loss ORDER BY year_of_loss" | |
| canvas_id | Yes | Canvas ID returned by fema_search_nfip, fema_get_public_assistance, or fema_get_housing_assistance. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The canvas row limit, present only when it capped the result. Absent when only the response budget cut it. | |
| rows | No | Result rows from the query, bounded by the canvas row limit and by 100,000 characters of rows — when the truncated enrichment field is set, page the remainder with OFFSET (see the notice guidance). | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Number of rows in this truncated response — the amount to advance OFFSET by, and to lower any LIMIT by, for the next page. | |
| notice | No | Continuation guidance when truncated — how far to advance OFFSET, and lower any LIMIT, under an ORDER BY, to page the remainder. | |
| canvas_id | No | Canvas ID that was queried — reuse for follow-up queries. | |
| row_count | No | Number of rows in this response — fewer than the query returned when truncated is set. | |
| truncated | No | True when more rows match than this response holds: the result was capped at the canvas row limit, or cut at the 100,000-character response budget. |