Skip to main content
Glama

get_weather_warnings

Retrieve active weather warnings for Portugal to monitor meteorological hazards and plan accordingly using IPMA data.

Instructions

Obter avisos meteorológicos ativos em Portugal

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that fetches active weather warnings from the IPMA API, processes them, and formats a response message.
    private async getWeatherWarnings() {
      try {
        const response = await fetch(`${this.baseUrl}/forecast/warnings/warnings_www.json`);
        const data = await response.json() as WeatherWarning[];
    
        if (!Array.isArray(data) || data.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: "✅ Não há avisos meteorológicos ativos no momento."
              }
            ]
          };
        }
    
        let result = "⚠️ **Avisos Meteorológicos Ativos**\n\n";
        
        data.forEach((warning: WeatherWarning) => {
          const startDate = new Date(warning.startTime).toLocaleString('pt-PT');
          const endDate = new Date(warning.endTime).toLocaleString('pt-PT');
          
          result += `🚨 **${warning.awarenessTypeName}**\n`;
          result += `📍 Área: ${warning.idAreaAviso}\n`;
          result += `🔴 Nível: ${warning.awarenessLevelID}\n`;
          result += `⏰ De: ${startDate}\n`;
          result += `⏰ Até: ${endDate}\n`;
          if (warning.text) {
            result += `📝 Detalhes: ${warning.text}\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 avisos: ${errorMessage}`);
      }
    }
  • src/index.ts:151-158 (registration)
    Tool registration in the ListTools response, including name, description, and empty input schema.
    {
      name: "get_weather_warnings",
      description: "Obter avisos meteorológicos ativos em Portugal",
      inputSchema: {
        type: "object",
        properties: {}
      }
    },
  • src/index.ts:211-212 (registration)
    Dispatch case in the main CallToolRequest handler that invokes the getWeatherWarnings method.
    case "get_weather_warnings":
      return await this.getWeatherWarnings();
  • TypeScript interface defining the structure of weather warning data from the API.
    interface WeatherWarning {
      text: string;
      awarenessTypeName: string;
      idAreaAviso: string;
      startTime: string;
      awarenessLevelID: string;
      endTime: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states what the tool does but doesn't disclose behavioral traits such as data freshness (e.g., real-time vs. cached), rate limits, authentication needs, error handling, or output format. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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 in Portuguese that directly states the tool's function without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. There's zero waste or redundancy.

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 no annotations, no output schema, and a simple input schema, the description is incomplete. It lacks details on what the output contains (e.g., warning types, severity, locations), how data is structured, or any operational constraints. For a tool that likely returns dynamic warning data, more context is needed for effective use.

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 with 100% schema description coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on the tool's purpose. This meets the baseline for tools with no parameters, though it doesn't add extra semantic value beyond the empty schema.

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 action ('Obter' meaning 'Get') and resource ('avisos meteorológicos ativos' meaning 'active weather warnings') with geographic scope ('em Portugal' meaning 'in Portugal'). It distinguishes from siblings like get_weather_forecast by focusing on warnings rather than forecasts. However, it doesn't specify if this includes all warning types or severity levels, keeping it from 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?

No explicit guidance on when to use this tool versus alternatives like get_weather_forecast or get_seismic_data. The description implies usage for active warnings in Portugal, but doesn't clarify if this is for real-time alerts, planning purposes, or how it differs from forecast data. No exclusions or prerequisites are mentioned.

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