Skip to main content
Glama

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
NameRequiredDescriptionDefault
prefectureYes

Implementation Reference

  • 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,
        }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/koizumikento/jma-data-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server