get_forecast
Retrieve weather forecasts for Japanese prefectures using Japan Meteorological Agency data to plan activities and prepare for conditions.
Instructions
Get weather forecast for a prefecture.
Args: prefecture: Prefecture name in English (e.g., 'tokyo', 'osaka', 'hokkaido_sapporo')
Returns: Weather forecast data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prefecture | Yes |
Implementation Reference
- jma_data_mcp/server.py:183-205 (handler)The get_forecast tool handler function, registered via @mcp.tool(). It validates the prefecture against AREA_CODES, fetches the forecast data using fetch_forecast, and returns formatted results or an error.@mcp.tool() async def get_forecast(prefecture: str) -> dict: """Get weather forecast for a prefecture. Args: prefecture: Prefecture name in English (e.g., 'tokyo', 'osaka', 'hokkaido_sapporo') Returns: Weather forecast data """ area_code = AREA_CODES.get(prefecture) if not area_code: return { "error": f"Unknown prefecture: {prefecture}", "available": list(AREA_CODES.keys()), } forecast_data = await fetch_forecast(area_code) return { "prefecture": prefecture, "area_code": area_code, "forecast": forecast_data, }