Skip to main content
Glama
campertunity

Campertunity MCP Server

Official
by campertunity

place-availability

Check campsite availability by entering place ID, site IDs, and date range to verify booking options for specific locations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
placeIdYesThe id of the place to check availability for.
siteIdsNoThe ids of the sites to check availability for.
startDateYesThe start date to check availability for. Format: YYYY-MM-DD
endDateYesThe end date to check availability for. Format: YYYY-MM-DD

Implementation Reference

  • The asynchronous handler function that implements the core logic of the 'place-availability' tool. It makes a POST request to the Campertunity API with placeId, siteIds, startDate, and endDate, and returns the availability data as JSON or an error message.
    async ({ placeId, siteIds, startDate, endDate }) => { try { const availability = await campertunityClient.post(`/place/availability`, { placeId, siteIds, startDate, endDate, }); return { content: [{ type: 'text', text: JSON.stringify(availability), mimeType: 'application/json' }], }; } catch (error) { return { content: [{ type: 'text', text: 'Error: ' + (error as Error).message }], isError: true, }; } }
  • Zod schema defining the input parameters for the 'place-availability' tool, including placeId (required), siteIds (optional array), startDate, and endDate, all as strings with descriptions.
    { placeId: z.string().describe('The id of the place to check availability for.'), siteIds: z.array(z.string()).optional().describe('The ids of the sites to check availability for.'), startDate: z.string().describe('The start date to check availability for. Format: YYYY-MM-DD'), endDate: z.string().describe('The end date to check availability for. Format: YYYY-MM-DD'), },
  • The server.tool() call within the placeAvailabilityTool function that registers the 'place-availability' tool on the MCP server, specifying the tool name, input schema, and handler function. This function is invoked from src/index.ts.
    server.tool( 'place-availability', { placeId: z.string().describe('The id of the place to check availability for.'), siteIds: z.array(z.string()).optional().describe('The ids of the sites to check availability for.'), startDate: z.string().describe('The start date to check availability for. Format: YYYY-MM-DD'), endDate: z.string().describe('The end date to check availability for. Format: YYYY-MM-DD'), }, async ({ placeId, siteIds, startDate, endDate }) => { try { const availability = await campertunityClient.post(`/place/availability`, { placeId, siteIds, startDate, endDate, }); return { content: [{ type: 'text', text: JSON.stringify(availability), mimeType: 'application/json' }], }; } catch (error) { return { content: [{ type: 'text', text: 'Error: ' + (error as Error).message }], isError: true, }; } } );
  • src/index.ts:23-23 (registration)
    Invocation of the placeAvailabilityTool function to register the 'place-availability' tool on the main MCP server instance.
    placeAvailabilityTool(server, campertunityClient);

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

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