Skip to main content
Glama

get_seismic_data

Retrieve recent seismic activity data for Portugal, including mainland, Azores, and Madeira regions, to monitor earthquakes and assess geological events.

Instructions

Obter dados sísmicos recentes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
areaNoÁrea: 'continent', 'azores', 'madeira', ou 'all'all

Implementation Reference

  • The core handler function that maps the area parameter to IPMA seismic API endpoints, fetches recent earthquake data, formats the top 10 events with details like time, location, magnitude, depth, and coordinates into a markdown text response, and returns it in MCP format. Handles no-data case and errors.
    private async getSeismicData(area: string) { try { let areaId: number; switch (area.toLowerCase()) { case "continent": areaId = 1; break; case "azores": areaId = 2; break; case "madeira": areaId = 3; break; default: areaId = 1; // Default to continent } const response = await fetch(`${this.baseUrl}/observation/seismic/${areaId}.json`); const data = await response.json() as ApiResponse<SeismicData>; if (!data.data || data.data.length === 0) { return { content: [ { type: "text", text: "📍 Não há dados sísmicos recentes para a área especificada." } ] }; } let result = `🌍 **Dados Sísmicos - ${area}**\n\n`; result += `🕐 Última atualização: ${data.data[0]?.dataUpdate}\n\n`; // Mostrar apenas os 10 mais recentes const recentData = data.data.slice(0, 10); recentData.forEach((earthquake: SeismicData) => { const eventTime = new Date(earthquake.time).toLocaleString('pt-PT'); result += `📅 **${eventTime}**\n`; result += `📍 Local: ${earthquake.obsRegion || 'N/A'}\n`; result += `📏 Magnitude: ${earthquake.magnitud} ${earthquake.magType}\n`; result += `🌊 Profundidade: ${earthquake.depth} km\n`; result += `🗺️ Coordenadas: ${earthquake.lat}, ${earthquake.lon}\n\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 sísmicos: ${errorMessage}`); } }
  • src/index.ts:159-172 (registration)
    Registration of the 'get_seismic_data' tool in the ListTools handler, including its description and input schema defining an optional 'area' parameter.
    { name: "get_seismic_data", description: "Obter dados sísmicos recentes", inputSchema: { type: "object", properties: { area: { type: "string", description: "Área: 'continent', 'azores', 'madeira', ou 'all'", default: "all" } } } },
  • TypeScript interface defining the structure of individual seismic event data from the IPMA API, used in the handler for type safety.
    interface SeismicData { degree: string | null; dataUpdate: string; magType: string; obsRegion: string; lon: string; source: string; depth: number; time: string; lat: string; local: string | null; magnitud: string; }
  • Dispatcher case in the central CallToolRequestSchema handler that invokes the specific getSeismicData method with the provided or default area argument.
    case "get_seismic_data": return await this.getSeismicData(toolArgs?.area || "all");

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