Query CKAN Table
ckan_query_dataQuery rows from CKAN resources with exact filters, full-text search, column selection, sorting, and distinct values; check the resource is queryable first.
Instructions
Read rows from a queryable resource, with filters, full-text search, column selection, sorting and distinct values. Only works where ckan_get_dataset shows the resource as queryable.
Call ckan_get_resource first for the column names: an unknown column is an error.
Examples:
Rows for one region -> filters={"region": "ภาคเหนือ"}
Several values -> filters={"region": ["ภาคเหนือ", "ภาคใต้"]}
Which regions exist -> fields=["region"], distinct=true
Highest values first -> sort="Per_HH_Tablet desc", limit=5
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": {
"site": "<site>",
"resource_id": "<resource_id>"
},
"name": "ckan_query_data"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | Full-text search across all columns | |
| site | Yes | Site alias from ckan_list_sites, e.g. 'nso' | |
| sort | No | e.g. 'year desc, region' | |
| limit | No | Rows to return. Fewer may come back if the response would be too long | |
| fields | No | Columns to return. Default: all | |
| offset | No | Rows to skip, for pagination | |
| filters | No | Exact matches by column; a list matches any of its values | |
| distinct | No | Return only distinct rows; combine with fields | |
| resource_id | Yes | Resource UUID | |
| response_format | No | 'markdown' for readable text, 'json' for structured data | markdown |