Skip to main content
Glama

get_weather_warnings

Retrieve active weather warnings for Portugal to monitor hazardous conditions and plan accordingly using official meteorological 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 endpoint and formats them into a text response.
    async getWeatherWarnings() { try { const response = await fetch(`${this.baseUrl}/forecast/warnings/warnings_www.json`); const data = await response.json(); 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) => { 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}`); } }
  • Tool schema registration including name, description, and input schema (no required parameters).
    { name: "get_weather_warnings", description: "Obter avisos meteorológicos ativos em Portugal", inputSchema: { type: "object", properties: {} } },
  • src/index.js:110-111 (registration)
    Registration in the tool dispatcher switch statement that routes calls to the getWeatherWarnings handler.
    case "get_weather_warnings": return await this.getWeatherWarnings();

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