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

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