list_prefectures
Retrieve prefecture codes for accessing Japan Meteorological Agency weather forecasts. Use this tool to identify available regions before requesting specific weather data.
Instructions
List all available prefecture codes for weather forecast.
Returns: Dictionary of prefecture names and their codes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- jma_data_mcp/server.py:208-216 (handler)The handler function for the 'list_prefectures' tool, registered via @mcp.tool() decorator. It simply returns a dictionary containing the AREA_CODES mapping of prefecture names to their JMA area codes.@mcp.tool() async def list_prefectures() -> dict: """List all available prefecture codes for weather forecast. Returns: Dictionary of prefecture names and their codes """ return {"prefectures": AREA_CODES}
- jma_data_mcp/weather.py:438-487 (helper)Constant dictionary AREA_CODES that maps English prefecture names to JMA forecast area codes, directly used and returned by the list_prefectures tool.# Area codes for major prefectures AREA_CODES = { "hokkaido_sapporo": "016000", "aomori": "020000", "iwate": "030000", "miyagi": "040000", "akita": "050000", "yamagata": "060000", "fukushima": "070000", "ibaraki": "080000", "tochigi": "090000", "gunma": "100000", "saitama": "110000", "chiba": "120000", "tokyo": "130000", "kanagawa": "140000", "niigata": "150000", "toyama": "160000", "ishikawa": "170000", "fukui": "180000", "yamanashi": "190000", "nagano": "200000", "gifu": "210000", "shizuoka": "220000", "aichi": "230000", "mie": "240000", "shiga": "250000", "kyoto": "260000", "osaka": "270000", "hyogo": "280000", "nara": "290000", "wakayama": "300000", "tottori": "310000", "shimane": "320000", "okayama": "330000", "hiroshima": "340000", "yamaguchi": "350000", "tokushima": "360000", "kagawa": "370000", "ehime": "380000", "kochi": "390000", "fukuoka": "400000", "saga": "410000", "nagasaki": "420000", "kumamoto": "430000", "oita": "440000", "miyazaki": "450000", "kagoshima": "460000", "okinawa": "470000", }
- jma_data_mcp/server.py:208-208 (registration)The @mcp.tool() decorator registers the list_prefectures function as an MCP tool.@mcp.tool()