get_weather_by_location
Retrieve current weather conditions from the nearest AMeDAS station using latitude and longitude coordinates. Provides real-time meteorological data for specific locations across Japan.
Instructions
Get current weather from the nearest AMeDAS station to given coordinates.
Args: lat: Latitude in decimal degrees lon: Longitude in decimal degrees
Returns: Weather data from the nearest station
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lat | Yes | ||
| lon | Yes |
Implementation Reference
- jma_data_mcp/server.py:153-180 (handler)Handler function for the get_weather_by_location tool. It finds the nearest AMeDAS station to the given coordinates and fetches current weather data from it. The @mcp.tool() decorator registers the tool.@mcp.tool() async def get_weather_by_location( lat: float, lon: float, ) -> dict: """Get current weather from the nearest AMeDAS station to given coordinates. Args: lat: Latitude in decimal degrees lon: Longitude in decimal degrees Returns: Weather data from the nearest station """ nearby = search_stations_by_location(lat, lon, radius_km=100) if not nearby: return {"error": "No stations found within 100km of the specified location"} nearest = nearby[0] station_code = nearest["code"] weather_data = await fetch_amedas_data(station_code) return { "observation_time": weather_data["observation_time"], "observation_time_jst": weather_data["observation_time_jst"], "station": nearest, "weather": weather_data["stations"].get(station_code, {}), }
- jma_data_mcp/server.py:153-153 (registration)The @mcp.tool() decorator registers the get_weather_by_location function as an MCP tool.@mcp.tool()