get_data_catalog_csv
Retrieve Japanese government statistics catalog data in CSV format from e-Stat. Search and filter by keywords, statistical fields, codes, years, or other parameters to access structured data for analysis.
Instructions
データカタログ情報をCSVで取得する.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search_word | No | ||
| stats_field | No | ||
| stats_code | No | ||
| gov_code | No | ||
| survey_years | No | ||
| open_years | No | ||
| stats_name_list | No | ||
| updated_date | No | ||
| start_position | No | ||
| limit | No |
Input Schema (JSON Schema)
{
"properties": {
"gov_code": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null
},
"open_years": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"search_word": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"start_position": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null
},
"stats_code": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"stats_field": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"stats_name_list": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"survey_years": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"updated_date": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
}
},
"type": "object"
}
Implementation Reference
- e_stats_mcp/tools/catalog.py:63-103 (handler)The main handler function for the 'get_data_catalog_csv' tool. It builds query parameters based on input arguments and uses _make_request to fetch the data catalog in CSV format from the e-Stat API.async def get_data_catalog_csv( search_word: str | None = None, stats_field: str | None = None, stats_code: str | None = None, gov_code: str | None = None, survey_years: str | None = None, open_years: str | None = None, stats_name_list: str | None = None, updated_date: str | None = None, start_position: int | None = None, limit: int | None = None, ) -> str: """データカタログ情報をCSVで取得する.""" params: dict = {} if search_word: params["searchWord"] = search_word if stats_field: params["statsField"] = stats_field if stats_code: params["statsCode"] = stats_code if gov_code: params["governmentCode"] = gov_code if survey_years: params["surveyYears"] = survey_years if open_years: params["openYears"] = open_years if stats_name_list: params["statsNameList"] = stats_name_list if updated_date: params["updatedDate"] = updated_date if start_position: params["startPosition"] = str(start_position) if limit: params["limit"] = str(limit) response = await _make_request( "getSimpleDataCatalog", params, format="csv", ) return cast(str, response)
- e_stats_mcp/main.py:55-55 (registration)Registration of the 'get_data_catalog_csv' tool using the FastMCP tool decorator.mcp.tool()(get_data_catalog_csv)
- e_stats_mcp/main.py:9-55 (registration)Import statement in main.py that brings in the get_data_catalog_csv function 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, ) # MCPサーバー初期化 mcp = FastMCP( "e-stats-mcp", instructions=""" e-Stat(政府統計の総合窓口)APIにアクセスするためのMCPサーバーです。 主な機能 (JSON/CSV 両対応): - 統計表情報の検索・取得 - メタ情報の取得 - 統計データの取得・一括取得 - データセットの登録・参照 - データカタログ情報の取得 使用にはe-Stat APIキー(E_STAT_API_KEY環境変数)が必要です。 APIキーは https://www.e-stat.go.jp/api/ から取得できます。 """, ) # ツールを登録 mcp.tool()(get_stats_list) mcp.tool()(get_stats_list_csv) mcp.tool()(get_meta_info) mcp.tool()(get_meta_info_csv) mcp.tool()(get_stats_data) mcp.tool()(get_stats_data_csv) mcp.tool()(get_stats_data_bulk) mcp.tool()(search_stats_by_keyword) mcp.tool()(post_dataset) mcp.tool()(get_dataset) mcp.tool()(get_data_catalog) mcp.tool()(get_data_catalog_csv)
- e_stats_mcp/tools/__init__.py:17-17 (helper)Import of the get_data_catalog_csv function into the tools package __init__ for easy access.from e_stats_mcp.tools.catalog import get_data_catalog, get_data_catalog_csv
- e_stats_mcp/tools/__init__.py:32-32 (helper)Inclusion of 'get_data_catalog_csv' in the __all__ list for package export."get_data_catalog_csv",