Skip to main content
Glama

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
NameRequiredDescriptionDefault
stats_data_idsNo
dataset_idsNo
start_positionNo
limitNo

Implementation Reference

  • 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)
  • Registers the get_stats_data_bulk function as an MCP tool using the FastMCP tool decorator.
    mcp.tool()(get_stats_data_bulk)
  • 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,
  • 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,
    )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/koizumikento/e-stats-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server