Skip to main content
Glama

search_nearby_stations

Find nearby AMeDAS weather stations within a specified radius from given coordinates to access Japan Meteorological Agency data.

Instructions

Search AMeDAS stations within a radius from given coordinates.

Args: lat: Latitude in decimal degrees lon: Longitude in decimal degrees radius_km: Search radius in kilometers (default: 50)

Returns: List of nearby stations sorted by distance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYes
lonYes
radius_kmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for search_nearby_stations that wraps the helper function and formats the response.
    @mcp.tool()
    async def search_nearby_stations(
        lat: float,
        lon: float,
        radius_km: float = 50.0,
    ) -> dict:
        """Search AMeDAS stations within a radius from given coordinates.
    
        Args:
            lat: Latitude in decimal degrees
            lon: Longitude in decimal degrees
            radius_km: Search radius in kilometers (default: 50)
    
        Returns:
            List of nearby stations sorted by distance
        """
        stations = search_stations_by_location(lat, lon, radius_km)
        return {
            "count": len(stations),
            "search_center": {"lat": lat, "lon": lon},
            "radius_km": radius_km,
            "stations": stations,
        }
  • Core implementation using Haversine formula to compute distances and find nearby stations.
    def search_stations_by_location(
        lat: float,
        lon: float,
        radius_km: float = 50.0
    ) -> list[dict]:
        """Search stations within radius from given location."""
        import math
    
        stations = load_stations()
        results = []
    
        for station in stations.values():
            station_lat = station["location"]["lat"]
            station_lon = station["location"]["lon"]
    
            # Haversine formula for distance calculation
            lat1, lon1 = math.radians(lat), math.radians(lon)
            lat2, lon2 = math.radians(station_lat), math.radians(station_lon)
    
            dlat = lat2 - lat1
            dlon = lon2 - lon1
    
            a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2
            c = 2 * math.asin(math.sqrt(a))
    
            # Earth radius in km
            r = 6371
            distance = r * c
    
            if distance <= radius_km:
                result = station.copy()
                result["distance_km"] = round(distance, 2)
                results.append(result)
    
        # Sort by distance
        results.sort(key=lambda x: x["distance_km"])
        return results
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the default radius and that results are sorted by distance, which adds useful context. However, it lacks details on permissions, rate limits, error conditions, or pagination, leaving gaps for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is front-loaded with the core purpose in the first sentence, followed by a structured 'Args' and 'Returns' section. Every sentence earns its place by providing essential information without redundancy, making it efficient and well-organized.

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

Completeness4/5

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

Given the tool's moderate complexity (3 parameters, no annotations, but with an output schema), the description is fairly complete. It covers purpose, parameters, and return behavior. However, with no annotations, it could benefit from more behavioral details like error handling or performance expectations to fully compensate for the lack of structured metadata.

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

Parameters4/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 clearly explains all three parameters: 'lat' and 'lon' as decimal degrees coordinates, and 'radius_km' as search radius in kilometers with a default of 50. This adds meaningful semantics beyond the bare schema, though it could specify valid ranges or units more explicitly.

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

Purpose5/5

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

The description clearly states the specific action ('Search AMeDAS stations within a radius'), identifies the resource ('AMeDAS stations'), and distinguishes from siblings by focusing on geographic proximity rather than station types, weather data, or administrative lists.

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

Usage Guidelines4/5

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

The description implies usage context through the mention of coordinates and radius, suggesting this tool is for finding stations near a specific location. However, it does not explicitly state when to use this versus alternatives like 'search_stations' or 'list_stations', leaving some ambiguity about sibling differentiation.

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