get_stats_data_bulk
Retrieve multiple statistical datasets from Japan's official government statistics portal in a single operation to analyze census data, economic indicators, and demographic information.
Instructions
複数の統計表ID/データセットIDから統計データを一括取得する.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stats_data_ids | No | ||
| dataset_ids | No | ||
| start_position | No | ||
| limit | No |
Implementation Reference
- e_stats_mcp/tools/stats.py:450-475 (handler)The primary handler function for the 'get_stats_data_bulk' tool. It accepts lists of stats_data_ids or dataset_ids, optional pagination params, constructs a params dict, and performs a POST request to the e-Stat API endpoint 'json/getStatsDatas' using the internal _make_request helper.async def get_stats_data_bulk( stats_data_ids: list[str] | None = None, dataset_ids: list[str] | None = None, start_position: int | None = None, limit: int | None = None, ) -> dict: """複数の統計表ID/データセットIDから統計データを一括取得する.""" params: dict = {"lang": "J"} if stats_data_ids: params["statsDataId"] = ",".join(stats_data_ids) if dataset_ids: params["datasetId"] = ",".join(dataset_ids) if start_position: params["startPosition"] = str(start_position) if limit: params["limit"] = str(limit) # getStatsDatas は POST エンドポイントのため method="POST" とし、 # 本文にも同じ params を送る response = await _make_request( "json/getStatsDatas", params, method="POST", data=params, ) return cast(dict[str, Any], response)
- e_stats_mcp/main.py:52-52 (registration)Registers the get_stats_data_bulk function as an MCP tool using the FastMCP tool decorator.mcp.tool()(get_stats_data_bulk)
- e_stats_mcp/tools/__init__.py:10-10 (helper)Imports the get_stats_data_bulk handler from the stats.py module into the tools package __init__.py, enabling its re-export for use in main.py.get_stats_data_bulk,
- e_stats_mcp/main.py:11-25 (registration)Imports the get_stats_data_bulk function (line 19) from the tools package into main.py for registration.from e_stats_mcp.tools import ( get_data_catalog, get_data_catalog_csv, get_dataset, get_meta_info, get_meta_info_csv, get_stats_fields, get_stats_data, get_stats_data_bulk, get_stats_data_csv, get_stats_list, get_stats_list_csv, post_dataset, search_stats_by_keyword, )