Skip to main content
Glama
KyrieTangSheng

National Parks MCP Server

getCampgrounds

Find campgrounds in U.S. National Parks with amenities, search by park code or name, and filter results for trip planning.

Instructions

Get information about available campgrounds and their amenities

Input Schema

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

Implementation Reference

  • The primary handler function for the 'getCampgrounds' tool. It validates input, calls the NPS API client to fetch campgrounds data, formats the response, groups by park, and returns a JSON-formatted text content response.
    export async function getCampgroundsHandler(args: z.infer<typeof GetCampgroundsSchema>) {
      // 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.getCampgrounds(requestParams);
      
      // Format the response for better readability by the AI
      const formattedCampgrounds = formatCampgroundData(response.data);
      
      // Group campgrounds by park code for better organization
      const campgroundsByPark: { [key: string]: any[] } = {};
      formattedCampgrounds.forEach(campground => {
        if (!campgroundsByPark[campground.parkCode]) {
          campgroundsByPark[campground.parkCode] = [];
        }
        campgroundsByPark[campground.parkCode].push(campground);
      });
      
      const result = {
        total: parseInt(response.total),
        limit: parseInt(response.limit),
        start: parseInt(response.start),
        campgrounds: formattedCampgrounds,
        campgroundsByPark: campgroundsByPark
      };
      
      return {
        content: [{ 
          type: "text", 
          text: JSON.stringify(result, null, 2)
        }]
      };
    } 
  • Zod schema defining the input parameters for the getCampgrounds tool, including optional filters for parkCode, limit, start, and search query.
    export const GetCampgroundsSchema = z.object({
      parkCode: z.string().optional().describe('Filter campgrounds 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 campgrounds 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 campgrounds by name or description')
    });
  • src/server.ts:63-67 (registration)
    Tool registration in the ListTools response, defining the name, description, and input schema for getCampgrounds.
    {
      name: "getCampgrounds",
      description: "Get information about available campgrounds and their amenities",
      inputSchema: zodToJsonSchema(GetCampgroundsSchema),
    },
  • src/server.ts:105-108 (registration)
    Dispatch handler in the CallToolRequest switch statement that parses arguments with the schema and calls the getCampgroundsHandler.
    case "getCampgrounds": {
      const args = GetCampgroundsSchema.parse(request.params.arguments);
      return await getCampgroundsHandler(args);
    }
  • Helper method in NPS API client that makes the HTTP request to the NPS campgrounds endpoint and returns the raw API response.
    async getCampgrounds(params: CampgroundQueryParams = {}): Promise<NPSResponse<CampgroundData>> {
      try {
        const response = await this.api.get('/campgrounds', { params });
        return response.data;
      } catch (error) {
        console.error('Error fetching campgrounds data:', error);
        throw error;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'gets information,' implying a read-only operation, but doesn't clarify if it's safe, requires authentication, has rate limits, or what the output format looks like. For a tool with 4 parameters and no output schema, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that efficiently conveys the core purpose. It's front-loaded with the main action and resource, with no unnecessary words. However, it could be slightly more structured by including brief usage context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (4 parameters, no annotations, no output schema), the description is incomplete. It doesn't explain what information is returned (e.g., campground names, locations, amenities details), how results are structured, or any behavioral traits like pagination or error handling. This makes it inadequate for an agent to fully understand the tool's operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 4 parameters. The description doesn't add any parameter-specific details beyond what's in the schema, such as examples or usage tips. However, it implies filtering by amenities, which isn't directly covered in the schema, adding minimal value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get information about available campgrounds and their amenities.' It specifies the verb ('Get') and resource ('campgrounds'), and adds value by mentioning 'amenities' which isn't obvious from the name. However, it doesn't explicitly differentiate from sibling tools like 'findParks' or 'getParkDetails,' which might also provide campground information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'findParks' or 'getParkDetails,' which could overlap in functionality. There's no context about prerequisites, such as needing park codes, or when to choose this over other tools for campground-related queries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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