Skip to main content
Glama
KyrieTangSheng

National Parks MCP Server

getParkDetails

Retrieve comprehensive details about a specific U.S. national park by providing its unique park code. Access information on alerts, visitor centers, campgrounds, and upcoming events for informed planning.

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 primary handler function that executes the getParkDetails tool: fetches park data from NPS API by parkCode, handles not found case, formats details, and returns as JSON-formatted 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, defining the required parkCode parameter with description.
    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 metadata exposed via ListTools: name, description, and input schema.
    { name: "getParkDetails", description: "Get detailed information about a specific national park", inputSchema: zodToJsonSchema(GetParkDetailsSchema), },
  • src/server.ts:90-93 (registration)
    Dispatch logic in CallTool handler: parses arguments with schema and invokes the getParkDetailsHandler.
    case "getParkDetails": { const args = GetParkDetailsSchema.parse(request.params.arguments); return await getParkDetailsHandler(args); }

Other Tools

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

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