post_dataset
Register datasets to Japan's official statistics portal by specifying dataset names, statistical table IDs, and retrieval conditions for data analysis.
Instructions
データセットを登録する.
Args: dataset_name: データセット名 stats_data_id: 統計表ID conditions: 取得条件(cdCatXX, cdTime, cdArea などを辞書で指定) description: 説明文
Returns: 登録結果
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dataset_name | Yes | ||
| stats_data_id | Yes | ||
| conditions | No | ||
| description | No |
Input Schema (JSON Schema)
{
"properties": {
"conditions": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null
},
"dataset_name": {
"type": "string"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null
},
"stats_data_id": {
"type": "string"
}
},
"required": [
"dataset_name",
"stats_data_id"
],
"type": "object"
}
Implementation Reference
- e_stats_mcp/tools/dataset.py:11-43 (handler)The main handler function `async def post_dataset(...)` that implements the tool logic by making a POST request to the e-Stat API's 'postDataset' endpoint with the provided parameters.async def post_dataset( dataset_name: str, stats_data_id: str, conditions: dict | None = None, description: str | None = None, ) -> dict: """データセットを登録する. Args: dataset_name: データセット名 stats_data_id: 統計表ID conditions: 取得条件(cdCatXX, cdTime, cdArea などを辞書で指定) description: 説明文 Returns: 登録結果 """ params = { "datasetName": dataset_name, "statsDataId": stats_data_id, } if description: params["description"] = description if conditions: params.update(conditions) response = await _make_request( "postDataset", params, method="POST", data=params, ) return cast(dict[str, Any], response)
- e_stats_mcp/main.py:52-52 (registration)Registers the `post_dataset` tool using `mcp.tool()(post_dataset)`.mcp.tool()(post_dataset)
- e_stats_mcp/tools/__init__.py:16-16 (registration)Imports `post_dataset` from `dataset.py` for use in the tools module.from e_stats_mcp.tools.dataset import get_dataset, post_dataset