search_stats_by_keyword
Search Japan's official government statistics by keyword to find census data, economic indicators, and demographic information across 17 statistical fields.
Instructions
キーワードで統計情報を検索する.
より簡単に統計表を検索するためのヘルパーツール。
Args: keyword: 検索キーワード(例: "人口", "GDP", "雇用") limit: 取得件数(デフォルト20件)
Returns: 検索結果のリスト
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes | ||
| limit | No |
Input Schema (JSON Schema)
{
"properties": {
"keyword": {
"type": "string"
},
"limit": {
"default": 20,
"type": "integer"
}
},
"required": [
"keyword"
],
"type": "object"
}
Implementation Reference
- e_stats_mcp/tools/stats.py:325-338 (handler)The main handler function implementing the tool logic. It wraps get_stats_list to search statistics by keyword with optional limit. Includes input schema via type hints and docstring.async def search_stats_by_keyword(keyword: str, limit: int = 20) -> dict: """キーワードで統計情報を検索する. より簡単に統計表を検索するためのヘルパーツール。 Args: keyword: 検索キーワード(例: "人口", "GDP", "雇用") limit: 取得件数(デフォルト20件) Returns: 検索結果のリスト """ return await get_stats_list(search_word=keyword, limit=limit)
- e_stats_mcp/main.py:51-51 (registration)Registration of the search_stats_by_keyword tool using the FastMCP tool decorator.mcp.tool()(search_stats_by_keyword)
- e_stats_mcp/main.py:22-23 (registration)Import of the search_stats_by_keyword function for registration in main.py.search_stats_by_keyword, )
- e_stats_mcp/tools/stats.py:68-111 (helper)Core helper function get_stats_list used by search_stats_by_keyword to perform the actual API search.async def get_stats_list( search_word: str | None = None, survey_years: str | None = None, stats_field: str | None = None, stats_code: str | None = None, gov_code: str | None = None, open_years: str | None = None, stats_name_list: str | None = None, start_position: int | None = None, updated_date: str | None = None, limit: int = 10, ) -> dict: """統計表情報を検索する. Args: search_word: 検索キーワード(統計表名、調査名など) survey_years: 調査年(YYYY形式、範囲指定はYYYY-YYYY) stats_field: 統計分野コード(2桁) stats_code: 政府統計コード(5桁または8桁) gov_code: 政府機関コード open_years: 公開年(YYYY形式、範囲指定はYYYY-YYYY) stats_name_list: 調査・集計の種類 start_position: データ取得開始位置 updated_date: 更新日(YYYY-MM-DD) limit: 取得件数(デフォルト10件、最大100件) Returns: 統計表情報のリスト """ params = _build_stats_list_params( search_word=search_word, survey_years=survey_years, stats_field=stats_field, stats_code=stats_code, gov_code=gov_code, open_years=open_years, stats_name_list=stats_name_list, start_position=start_position, updated_date=updated_date, limit=limit, ) response = await _make_request("json/getStatsList", params) return cast(dict[str, Any], response)