get_forecast
Retrieve weather forecasts for Japanese prefectures to plan activities and prepare for conditions.
Instructions
Get forecast for a location in Japan
Args:
prefecture: Name of the prefecture of Japan (in English alphabets, e.g.) "Hokkaido", "Tokyo", "Osaka", etc.)Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prefecture | Yes |
Implementation Reference
- mcp_tenki/main.py:234-265 (handler)The get_forecast tool handler implementation which fetches weather data from the tsukumijima API.
@mcp.tool() async def get_forecast(prefecture: str) -> str: """ Get forecast for a location in Japan Args: prefecture: Name of the prefecture of Japan (in English alphabets, e.g.) "Hokkaido", "Tokyo", "Osaka", etc.) """ location = convert_pref_to_id(prefecture=prefecture) if location is None: return "Unable to locate" url = f"https://weather.tsukumijima.net/api/forecast?city={location.id_}" res = await make_nws_request(url=url) if not res: return "Unable to fetch forecast data for this location." forecasts = [WeatherForecast(**f) for f in res["forecasts"]] return "\n------\n".join([f.format_forecast() for f in forecasts]) def main(): mcp.run(transport="stdio") if __name__ == "__main__": main()