get_stats_data_bulk
Retrieve multiple statistical datasets from Japan's official government statistics portal in a single request using table or dataset IDs.
Instructions
複数の統計表ID/データセットIDから統計データを一括取得する.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stats_data_ids | No | ||
| dataset_ids | No | ||
| start_position | No | ||
| limit | No |
Input Schema (JSON Schema)
{
"properties": {
"dataset_ids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null
},
"limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null
},
"start_position": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null
},
"stats_data_ids": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null
}
},
"type": "object"
}
Implementation Reference
- e_stats_mcp/tools/stats.py:450-476 (handler)The main handler function for the get_stats_data_bulk tool. It constructs parameters from input lists of stats_data_ids or dataset_ids and makes 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:50-50 (registration)Registers the get_stats_data_bulk tool with the FastMCP server using the mcp.tool() decorator.mcp.tool()(get_stats_data_bulk)
- e_stats_mcp/main.py:9-23 (registration)Imports get_stats_data_bulk from the tools module to make it available 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, )
- e_stats_mcp/tools/__init__.py:6-15 (helper)Re-exports get_stats_data_bulk from stats.py module in tools.__init__.from e_stats_mcp.tools.stats import ( get_meta_info, get_meta_info_csv, get_stats_data, get_stats_data_bulk, get_stats_data_csv, get_stats_list, get_stats_list_csv, search_stats_by_keyword, )
- e_stats_mcp/tools/__init__.py:20-34 (helper)Includes get_stats_data_bulk in __all__ for easy import from tools package.__all__ = [ "get_stats_list", "get_stats_list_csv", "get_meta_info", "get_meta_info_csv", "get_stats_data", "get_stats_data_csv", "get_stats_data_bulk", "search_stats_by_keyword", "post_dataset", "get_dataset", "get_data_catalog", "get_data_catalog_csv", "get_stats_fields", ]