Skip to main content
Glama

get_weather_stations

Retrieve real-time observational data from Portuguese meteorological stations to monitor current weather conditions across Portugal.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that fetches current weather observations from IPMA meteorological stations API, gets station names, selects latest observations for up to 15 stations, formats temperature, humidity, pressure, wind, precipitation into a markdown text response.
    async getWeatherStations() {
      try {
        const response = await fetch(`${this.baseUrl}/observation/meteorology/stations/observations.json`);
        const data = await response.json();
    
        const stationsResponse = await fetch(`${this.baseUrl}/observation/meteorology/stations/stations.json`);
        const stationsData = await stationsResponse.json();
    
        const stationsInfo = stationsData.reduce((acc, station) => {
          acc[station.properties.idEstacao] = station.properties.localEstacao;
          return acc;
        }, {});
    
        let result = "**Observações das Estações Meteorológicas**\n\n";
        
        const timestamps = Object.keys(data);
        const latestTimestamp = timestamps[timestamps.length - 1];
        const latestObservations = data[latestTimestamp];
    
        result += `Observações de: ${latestTimestamp}\n\n`;
    
        const stationIds = Object.keys(latestObservations).slice(0, 15);
        
        stationIds.forEach((stationId) => {
          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.js:82-89 (registration)
    Tool registration in the ListToolsRequestHandler response, defining the tool name, description, and input schema (no required parameters).
    {
      name: "get_weather_stations",
      description: "Obter dados de observação das estações meteorológicas",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • src/index.js:116-117 (registration)
    Switch case in CallToolRequestHandler that routes calls to the getWeatherStations handler method.
    case "get_weather_stations":
      return await this.getWeatherStations();
  • Input schema definition for the get_weather_stations tool, specifying an object with no properties.
    inputSchema: {
      type: "object",
      properties: {}
    }
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 the tool retrieves observation data, implying a read-only operation, but doesn't clarify aspects like data freshness, rate limits, authentication needs, or what happens if no data is available. 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.

Conciseness4/5

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

The description is a single, efficient sentence in Portuguese that directly states the tool's purpose without unnecessary words. It's appropriately sized for a tool with no parameters, though it could be slightly more informative without losing conciseness.

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

Completeness2/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 minimal. It lacks details on what 'dados de observação' includes (e.g., temperature, humidity), how data is returned, or any behavioral traits, making it incomplete for effective agent use despite the low complexity.

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 input schema has 0 parameters with 100% coverage, so no parameter information is needed. The description doesn't add parameter details, but this is acceptable as there are no parameters to document. A baseline of 4 is appropriate since the schema fully covers the absence of parameters.

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

Purpose3/5

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

The description 'Obter dados de observação das estações meteorológicas' (Get observation data from weather stations) states a clear verb ('Obter') and resource ('estações meteorológicas'), but it's vague about what specific data is retrieved and doesn't distinguish from siblings like 'get_weather_forecast' or 'get_weather_warnings'. It provides a basic purpose but lacks specificity.

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 such as 'get_weather_forecast' for forecasts or 'get_weather_warnings' for alerts. The description implies usage for observational data but doesn't specify contexts, exclusions, or prerequisites, leaving the agent to infer based on tool names alone.

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/brandao-20/mcp_server_ipma'

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