Idescat MCP Server
v1.1.1Query official statistics of Catalonia (Idescat): tables, metadata and JSON-stat data via MCP.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
get_idescat_stats
Obtains the complete list of Idescat statistics (all, normalized and non-normalized). It has no parameters. The response contains a 'statistics' array where each element has: 'acronym' (lowercase acronym, e.g., 'censph', to be used as the 'stat' argument of the other tools), 'name' (title), 'description' (summary), 'datasets' (boolean), 'geo' (array of available territorial disaggregations), and 'url' (initial web address, relative to https://www.idescat.cat). Use it when the user asks what statistics are available or when a statistic needs to be found by name or territorial disaggregation. TH…
get_idescat_stat
Obtains information about an Idescat (Statistical Institute of Catalonia) statistic given its acronym. Use it when the user asks about a specific statistic identified by its acronym (for example, CENSPH, EPA, PIBC, AFI, etc.). The 'datasets' field is a key boolean: if true, the statistic is normalized and therefore available in get_idescat_stat_tables and the rest of the table-level tools (metadata, data, divisions, etc.); if false, the statistic is NOT normalized and get_idescat_stat_tables will not recognize it (it would return an identifier error), so the only information available is what…
| Parameter | Type | Description |
|---|---|---|
stat * | string | Statistic acronym in lowercase (for example, 'afi', 'censph') |
get_idescat_stat_tables
Obtains the list of tables for an Idescat statistic given its official acronym. Use it when the user asks what tables or information a statistic has. The response contains a 'tables' array where each element has 'id' (numerical identifier) and 'name' (table title). Present each table as: name (id). Inform the user that they can request more details about a table by indicating its identifier.
| Parameter | Type | Description |
|---|---|---|
stat * | string | Statistic acronym in lowercase (for example, 'censph', 'piba') |
get_table_metadata
Obtains the metadata for a specific Idescat table in JSON-stat format, given the statistic acronym (stat) and the table identifier (table). Use it when the user wants to know the details of a table: dimensions, categories available for each dimension (time periods, territorial scopes, sex, etc.), date of last update, units, etc. The acronym and identifier are previously obtained with get_idescat_stat_tables. At the end of the response, always include this Markdown link (substituting {stat} and {table} in lowercase): [See the results in this table](https://www.idescat.cat/pub/?id={stat}&n={tabl…
| Parameter | Type | Description |
|---|---|---|
stat * | string | Statistic acronym in lowercase (for example, 'censph', 'piba') |
table * | string | Numerical identifier of the table, obtained from get_idescat_stat_tables (for example, '21654', '8607') |
geo | string | Territorial division code (optional, defaults to 'cat' = Catalonia as a whole). Other common values: 'prov' (provinces), 'at' (territorial plan areas), 'com' (counties and Aran), 'mun' (municipalities… |
get_table_data
Retrieves the data (values) of an Idescat table in JSON-stat format for a territorial division. You can retrieve the ENTIRE table (without filters) or only a SUBSET by passing the OPTIONAL parameters 'filters' (specific categories per dimension) and/or 'last' (number of last time periods); filtering returns smaller responses and allows querying tables that as a whole would exceed the limit. The filters use the dimension identifiers and category codes (category.index) returned by get_table_metadata (with the same 'geo'). IMPORTANT: the 20,000 cell limit is checked AFTER applying the filters; if…
| Parameter | Type | Description |
|---|---|---|
stat * | string | Statistic acronym in lowercase (for example, 'censph', 'piba') |
table * | string | Numerical identifier of the table, obtained from get_idescat_stat_tables (for example, '21654', '8607') |
derive | object | OPTIONAL. Derived metrics computed by the server. Results carry their own unit/decimals; cells that cannot be computed are null with status d. |
filters | object | OPTIONAL filter by dimension: the keys are dimension identifiers (for example, 'SEX', 'COM', 'YEAR') and the values are category codes separated by commas (for example, {"SEX": "F", "COM": "01,TOTAL"}… |
geo | string | Territorial division code (optional, defaults to 'cat' = Catalonia as a whole). Other values: 'prov', 'at', 'com', 'mun', 'dis', 'sec'. It must match the 'geo' checked in get_table_metadata. Divisions… |
last | integer | OPTIONAL. Number of last time periods to retrieve (for example, 2 = the two most recent years). Do not combine it with an explicit filter on the time dimension |
sum | array | OPTIONAL. Dimensions to collapse by adding up their categories (e.g. ["AGE"]). Only for additive metrics (listed in the metric dimension's extension "%"); TOTAL is excluded automatically; time, metric… |
get_table_geo
Obtains the list of territorial divisions available for an Idescat table (for example: cat=Catalonia, com=counties and Aran, mun=municipalities, prov=provinces, at=territorial plan areas). The response contains a 'divisions' array where each element has 'id' (division code) and 'name' (label). Often it is NOT necessary to call it because get_table_metadata already returns these divisions in 'link.related'. Use it only if you need the list of divisions without having called the metadata. The 'id' code is the value to pass to the 'geo' parameter of get_table_metadata, get_table_data, or render_t…
| Parameter | Type | Description |
|---|---|---|
stat * | string | Statistic acronym in lowercase (for example, 'censph', 'piba') |
table * | string | Numerical identifier of the table, obtained from get_idescat_stat_tables (for example, '21654', '8607') |
render_table
Returns a Markdown table already built with the filtered data from an Idescat table, ready to be shown to the user without having to interpret the JSON-stat. It includes the title, units, the table with category labels, status notes (e.g., provisional data), and ALWAYS a final link to the table on the Idescat website that must be kept in the response to the user. By default, it puts the time dimension in rows and the first dimension with more than one category in columns; this can be changed with the 'rows' and 'cols' parameters. All other dimensions with more than one category must be reduced…
| Parameter | Type | Description |
|---|---|---|
stat * | string | Statistic acronym in lowercase (for example, 'censph', 'piba') |
table * | string | Numerical identifier of the table, obtained from get_idescat_stat_tables (for example, '21654', '8607') |
cols | string | Identifier of the dimension that should go in the columns (for example, 'SEX'). Default: the first dimension with more than one category that is not the row one |
derive | object | OPTIONAL. Derived metrics computed by the server. Results carry their own unit/decimals; cells that cannot be computed are null with status d. |
filters | object | Filters by dimension: the keys are dimension identifiers (for example, 'SEX', 'COM', 'YEAR') and the values are category codes separated by commas (for example, {"SEX": "F", "COM": "01,TOTAL"}). The c… |
geo | string | Territorial division code, obtained from get_table_geo or from 'link.related' (per example, 'cat', 'com', 'mun', 'prov'). Default: 'cat' (Catalonia as a whole) |
last | integer | Number of last time periods to retrieve (for example, 2 = the two most recent years). Do not combine it with an explicit filter on the time dimension |
rows | string | Identifier of the dimension that should go in the rows (for example, 'YEAR'). Default: the time dimension (more periods fit in the rows than in the columns) |
sum | array | OPTIONAL. Dimensions to collapse by adding up their categories (e.g. ["AGE"]). Only for additive metrics (listed in the metric dimension's extension "%"); TOTAL is excluded automatically; time, metric… |