Skip to main content
Glama
KyrieTangSheng

National Parks MCP Server

getVisitorCenters

Find visitor center details and operating hours in U.S. National Parks using park code, search terms, or pagination filters.

Instructions

Get information about visitor centers and their operating hours

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of visitor centers to return (default: 10, max: 50)
parkCodeNoFilter visitor centers by park code (e.g., "yose" for Yosemite). Multiple parks can be comma-separated (e.g., "yose,grca").
qNoSearch term to filter visitor centers by name or description
startNoStart position for results (useful for pagination)

Implementation Reference

  • The main handler function getVisitorCentersHandler that implements the core logic of the tool: processes input args, calls NPS API via npsApiClient, formats the response data, groups by park, and returns structured JSON.
    export async function getVisitorCentersHandler(args: z.infer<typeof GetVisitorCentersSchema>) { // 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.getVisitorCenters(requestParams); // Format the response for better readability by the AI const formattedCenters = formatVisitorCenterData(response.data); // Group visitor centers by park code for better organization const centersByPark: { [key: string]: any[] } = {}; formattedCenters.forEach(center => { if (!centersByPark[center.parkCode]) { centersByPark[center.parkCode] = []; } centersByPark[center.parkCode].push(center); }); const result = { total: parseInt(response.total), limit: parseInt(response.limit), start: parseInt(response.start), visitorCenters: formattedCenters, visitorCentersByPark: centersByPark }; return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }
  • Zod schema defining the input validation for the getVisitorCenters tool parameters.
    export const GetVisitorCentersSchema = z.object({ parkCode: z.string().optional().describe('Filter visitor centers by park code (e.g., "yose" for Yosemite). Multiple parks can be comma-separated (e.g., "yose,grca").'), limit: z.number().optional().describe('Maximum number of visitor centers to return (default: 10, max: 50)'), start: z.number().optional().describe('Start position for results (useful for pagination)'), q: z.string().optional().describe('Search term to filter visitor centers by name or description') });
  • src/server.ts:58-62 (registration)
    Registration of the getVisitorCenters tool in the ListToolsRequestSchema handler, including name, description, and input schema reference.
    { name: "getVisitorCenters", description: "Get information about visitor centers and their operating hours", inputSchema: zodToJsonSchema(GetVisitorCentersSchema), },
  • src/server.ts:100-103 (registration)
    Dispatch logic in the CallToolRequestSchema handler that validates arguments with the schema and invokes the getVisitorCentersHandler.
    case "getVisitorCenters": { const args = GetVisitorCentersSchema.parse(request.params.arguments); return await getVisitorCentersHandler(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