Skip to main content
Glama

get_station_observations

Retrieve hourly weather observations from Portuguese stations for the past 24 hours, including temperature, humidity, pressure, wind, precipitation, and radiation data.

Instructions

Get meteorological observations from weather stations (Observações últimas 24 horas).

Args:
    station_id: ID of the weather station. Leave empty to see all stations.

Returns hourly meteorological observations from the last 24 hours including:
- Temperature
- Humidity  
- Pressure
- Wind speed and direction
- Precipitation
- Radiation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
station_idNo

Implementation Reference

  • The handler function for the 'get_station_observations' tool. It is decorated with @mcp.tool() which handles both the definition and registration in the FastMCP framework. Fetches and formats recent meteorological observations from IPMA weather stations based on station ID.
    async def get_station_observations(station_id: str = "") -> str:
        """Get meteorological observations from weather stations (Observações últimas 24 horas).
        
        Args:
            station_id: ID of the weather station. Leave empty to see all stations.
        
        Returns hourly meteorological observations from the last 24 hours including:
        - Temperature
        - Humidity  
        - Pressure
        - Wind speed and direction
        - Precipitation
        - Radiation
        """
        # Get observations
        obs_url = f"{IPMA_API_BASE}/observation/meteorology/stations/observations.json"
        obs_data = await make_ipma_request(obs_url)
        
        if not obs_data:
            return "Unable to fetch meteorological observations."
        
        # Get station information
        stations_url = f"{IPMA_API_BASE}/observation/meteorology/stations/stations.json"
        stations_data = await make_ipma_request(stations_url)
        
        # Create station mapping
        station_map = {}
        if stations_data and isinstance(stations_data, list):
            for station in stations_data:
                props = station.get('properties', {})
                station_map[str(props.get('idEstacao'))] = props.get('localEstacao', 'Unknown')
        
        if not station_id:
            # List available stations
            result = f"Available Weather Stations ({len(station_map)} total):\n\n"
            count = 0
            for sid, name in list(station_map.items())[:20]:
                result += f"ID: {sid} - {name}\n"
                count += 1
            result += f"\n... and {len(station_map) - count} more stations.\n"
            result += "\nUse station_id parameter to get observations for a specific station."
            return result
        
        # Get observations for specific station
        result = f"Meteorological Observations for Station {station_id}\n"
        result += f"Station Name: {station_map.get(station_id, 'Unknown')}\n\n"
        
        observations_found = False
        for timestamp, stations in obs_data.items():
            if station_id in stations:
                observations_found = True
                obs = stations[station_id]
                result += f"""Time: {timestamp} UTC
    Temperature: {obs.get('temperatura', 'N/A')}°C
    Humidity: {obs.get('humidade', 'N/A')}%
    Pressure: {obs.get('pressao', 'N/A')} hPa
    Wind Speed: {obs.get('intensidadeVento', 'N/A')} m/s ({obs.get('intensidadeVentoKM', 'N/A')} km/h)
    Wind Direction: {obs.get('idDireccVento', 'N/A')}
    Accumulated Precipitation: {obs.get('precAcumulada', 'N/A')} mm
    Radiation: {obs.get('radiacao', 'N/A')} W/m²
    ---
    """
        
        if not observations_found:
            result += f"No observations found for station {station_id} in the last 24 hours."
        
        return result
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the temporal scope (last 24 hours, hourly data) and data format (list of meteorological variables), but doesn't mention rate limits, authentication needs, error conditions, or pagination behavior for the 'all stations' case.

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. The bulleted list of return values is useful but could be slightly more concise. Every sentence adds value, though the Portuguese parenthetical could be integrated more smoothly.

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?

For a single-parameter read operation with no output schema, the description provides good coverage: purpose, parameter semantics, return data structure, and temporal scope. It lacks some behavioral details (like error handling) but is reasonably complete given the tool's moderate complexity.

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

Parameters5/5

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

The description adds significant value beyond the schema's 0% coverage. It explains that station_id is optional ('Leave empty to see all stations') and clarifies the parameter's purpose ('ID of the weather station'), which the schema only labels generically as 'Station Id'.

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 ('Get meteorological observations') and resource ('from weather stations'), with explicit scope ('last 24 hours', 'hourly'). It distinguishes from siblings like forecast tools by focusing on historical observations rather than predictions.

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 provides clear context about when to use this tool (for recent observational data) and implies when not to use it (for forecasts, aggregates, or other data types covered by siblings). However, it doesn't explicitly name alternatives or state exclusions.

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/gabriel20vieira/ipma-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server