Skip to main content
Glama
KyrieTangSheng

National Parks MCP Server

getParkDetails

Retrieve comprehensive details about U.S. National Parks using park codes to access information about facilities, alerts, and visitor resources.

Instructions

Get detailed information about a specific national park

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parkCodeYesThe park code of the national park (e.g., "yose" for Yosemite, "grca" for Grand Canyon)

Implementation Reference

  • The main handler function implementing the getParkDetails tool. Fetches park details from NPS API using parkCode, handles not found cases, formats the data, and returns as JSON text content.
    export async function getParkDetailsHandler(args: z.infer<typeof GetParkDetailsSchema>) { const response = await npsApiClient.getParkByCode(args.parkCode); // Check if park was found if (!response.data || response.data.length === 0) { return { content: [{ type: "text", text: JSON.stringify({ error: 'Park not found', message: `No park found with park code: ${args.parkCode}` }, null, 2) }] }; } // Format the response for better readability by the AI const parkDetails = formatParkDetails(response.data[0]); return { content: [{ type: "text", text: JSON.stringify(parkDetails, null, 2) }] }; }
  • Zod input schema for the getParkDetails tool, requiring a parkCode string.
    export const GetParkDetailsSchema = z.object({ parkCode: z.string().describe('The park code of the national park (e.g., "yose" for Yosemite, "grca" for Grand Canyon)') });
  • src/server.ts:48-52 (registration)
    Tool registration in the ListTools handler, defining name, description, and input schema for getParkDetails.
    { name: "getParkDetails", description: "Get detailed information about a specific national park", inputSchema: zodToJsonSchema(GetParkDetailsSchema), },
  • src/server.ts:90-93 (registration)
    Tool dispatch in the CallTool handler, parsing arguments with schema and calling the getParkDetailsHandler.
    case "getParkDetails": { const args = GetParkDetailsSchema.parse(request.params.arguments); return await getParkDetailsHandler(args); }

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

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