Skip to main content
Glama

get_weather_by_location

Retrieve current weather data from the nearest AMeDAS station using latitude and longitude coordinates. Provides real-time observations from Japan Meteorological Agency stations 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
NameRequiredDescriptionDefault
latYes
lonYes

Implementation Reference

  • The handler function decorated with @mcp.tool(), implementing the get_weather_by_location tool. It searches for the nearest AMeDAS station within 100km of the given lat/lon, fetches current weather data using fetch_amedas_data, and returns formatted station info and weather observations.
    @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, {}), }
  • The @mcp.tool() decorator registers the get_weather_by_location function as an MCP tool.
    @mcp.tool()
  • Function signature and docstring defining the input schema (lat: float, lon: float) and output type (dict), used by FastMCP for tool schema.
    async def get_weather_by_location( lat: float, lon: float, ) -> dict:

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