Skip to main content
Glama

National Parks MCP Server

getAlerts.ts1.25 kB
import { z } from 'zod'; import { GetAlertsSchema } from '../schemas.js'; import { npsApiClient } from '../utils/npsApiClient.js'; import { formatAlertData } from '../formatters.js'; export async function getAlertsHandler(args: z.infer<typeof GetAlertsSchema>) { // Set default limit if not provided or if it exceeds maximum const limit = args.limit ? Math.min(args.limit, 50) : 10; // Format the request parameters const requestParams = { limit, ...args }; const response = await npsApiClient.getAlerts(requestParams); // Format the response for better readability by the AI const formattedAlerts = formatAlertData(response.data); // Group alerts by park code for better organization const alertsByPark: { [key: string]: any[] } = {}; formattedAlerts.forEach(alert => { if (!alertsByPark[alert.parkCode]) { alertsByPark[alert.parkCode] = []; } alertsByPark[alert.parkCode].push(alert); }); const result = { total: parseInt(response.total), limit: parseInt(response.limit), start: parseInt(response.start), alerts: formattedAlerts, alertsByPark }; return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }

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/KyrieTangSheng/mcp-server-nationalparks'

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