Skip to main content
Glama

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
NameRequiredDescriptionDefault
latYes
lonYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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, {}),
        }
  • The @mcp.tool() decorator registers the get_weather_by_location function as an MCP tool.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions the tool fetches from the 'nearest AMeDAS station', which adds some context about data sourcing, but lacks details on permissions, rate limits, error handling, or what 'Weather data' entails beyond the output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args and Returns sections are structured but could be more integrated; overall, it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 2 parameters with 0% schema coverage and an output schema exists, the description is moderately complete. It explains the purpose and parameters but lacks behavioral context like error cases or limitations, and relies on the output schema for return values, which is acceptable but not fully comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaning by specifying 'Latitude in decimal degrees' and 'Longitude in decimal degrees', clarifying the coordinate format. However, it doesn't detail valid ranges or units beyond what's implied, leaving some gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'current weather from the nearest AMeDAS station', specifying the data source. It distinguishes from siblings like 'get_current_weather' by mentioning the station-based approach, though not explicitly contrasting them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'get_current_weather' or 'search_nearby_stations'. The description implies usage for current weather at coordinates but lacks explicit when/when-not instructions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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