Skip to main content
Glama

get_weather_stations

Retrieve real-time meteorological observation data from weather stations across Portugal to access current weather conditions and measurements.

Instructions

Obter dados de observação das estações meteorológicas

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that fetches weather station observations from the IPMA API, retrieves station info, selects the latest timestamp data, formats up to 15 stations' temperature, humidity, pressure, wind, and precipitation into a markdown text response.
    private async getWeatherStations() {
      try {
        const response = await fetch(`${this.baseUrl}/observation/meteorology/stations/observations.json`);
        const data = await response.json() as { [timestamp: string]: { [stationId: string]: StationObservation } };
    
        // Obter também informações das estações
        const stationsResponse = await fetch(`${this.baseUrl}/observation/meteorology/stations/stations.json`);
        const stationsData = await stationsResponse.json() as StationInfo[];
    
        const stationsInfo = stationsData.reduce((acc: any, station: StationInfo) => {
          acc[station.properties.idEstacao] = station.properties.localEstacao;
          return acc;
        }, {});
    
        let result = "🌡️ **Observações das Estações Meteorológicas**\n\n";
        
        // Pegar apenas as observações mais recentes (última timestamp)
        const timestamps = Object.keys(data);
        const latestTimestamp = timestamps[timestamps.length - 1];
        const latestObservations = data[latestTimestamp];
    
        result += `🕐 Observações de: ${latestTimestamp}\n\n`;
    
        // Mostrar apenas as primeiras 15 estações para não exceder limites
        const stationIds = Object.keys(latestObservations).slice(0, 15);
        
        stationIds.forEach((stationId: string) => {
          const obs = latestObservations[stationId];
          const stationName = stationsInfo[stationId] || `Estação ${stationId}`;
          
          result += `📍 **${stationName}**\n`;
          if (obs.temperatura > -99) result += `🌡️ Temperatura: ${obs.temperatura}°C\n`;
          if (obs.humidade > -99) result += `💧 Humidade: ${obs.humidade}%\n`;
          if (obs.pressao > -99) result += `📊 Pressão: ${obs.pressao} hPa\n`;
          if (obs.intensidadeVento > -99) result += `💨 Vento: ${obs.intensidadeVento} m/s\n`;
          if (obs.precAcumulada > -99) result += `🌧️ Precipitação: ${obs.precAcumulada} mm\n`;
          result += "\n";
        });
    
        return {
          content: [
            {
              type: "text",
              text: result
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new McpError(ErrorCode.InternalError, `Erro ao obter dados das estações: ${errorMessage}`);
      }
    }
  • src/index.ts:181-188 (registration)
    Registration of the 'get_weather_stations' tool in the ListToolsRequestSchema handler, including name, description, and empty input schema (no parameters required).
    {
      name: "get_weather_stations",
      description: "Obter dados de observação das estações meteorológicas",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • src/index.ts:217-218 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the getWeatherStations method.
    case "get_weather_stations":
      return await this.getWeatherStations();
  • Input schema for the tool: empty object (no required parameters).
    inputSchema: {
      type: "object",
      properties: {}
    }
  • TypeScript interfaces used by the handler for station observations and station metadata.
    interface StationObservation {
      temperatura: number;
      humidade: number;
      pressao: number;
      intensidadeVento: number;
      precAcumulada: number;
    }
Behavior2/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 states it gets observation data but doesn't specify what that entails—e.g., real-time vs. historical data, data format, rate limits, or authentication needs. This leaves significant gaps in understanding the tool's behavior.

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 a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is front-loaded and appropriately sized for a simple tool, making it highly concise and well-structured.

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 the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate. It states what data is retrieved but lacks details on data scope, format, or behavioral traits. For a basic read operation, this is acceptable but leaves room for improvement in context.

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?

The tool has 0 parameters, and schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, but it implies fetching data without specifying any input constraints, which is appropriate for a parameterless tool, warranting a baseline score of 4.

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 ('Obter' meaning 'Get') and resource ('dados de observação das estações meteorológicas' meaning 'observation data from weather stations'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_weather_forecast' or 'get_weather_warnings', which is why it doesn't achieve a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention context, prerequisites, or exclusions, leaving the agent to infer usage based on the tool name alone without any explicit instructions.

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

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