Skip to main content
Glama

getAllReservations

Retrieve filtered reservations from the Mews hospitality platform using specific IDs, customer details, states, or date ranges. Supports pagination and ensures results within a 100-hour time interval. Streamline reservation management with precise queries.

Instructions

Get reservations with filters. Note: The time interval between StartUtc and EndUtc must not exceed 100 hours.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
CustomerIdsNoFilter by customer IDs
EndUtcYesEnd date for search (ISO 8601)
LimitationNoPagination settings
ReservationIdsNoSpecific reservation IDs to retrieve
StartUtcYesStart date for search (ISO 8601)
StatesNoFilter by reservation states (Confirmed, Canceled, etc.)

Implementation Reference

  • Handler function that invokes the mewsRequest helper to POST to the Mews API /reservations/getAll endpoint with provided arguments and returns the prettified JSON response.
    async execute(config: MewsAuthConfig, args: unknown): Promise<ToolResult> { const result = await mewsRequest(config, '/api/connector/v1/reservations/getAll', args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • Input schema defining the structure and validation for tool parameters including filters, date range (required), and pagination options.
    inputSchema: { type: 'object', properties: { ReservationIds: { type: 'array', items: { type: 'string' }, description: 'Specific reservation IDs to retrieve' }, CustomerIds: { type: 'array', items: { type: 'string' }, description: 'Filter by customer IDs' }, States: { type: 'array', items: { type: 'string' }, description: 'Filter by reservation states (Confirmed, Canceled, etc.)' }, StartUtc: { type: 'string', description: 'Start date for search (ISO 8601)' }, EndUtc: { type: 'string', description: 'End date for search (ISO 8601)' }, Limitation: { type: 'object', properties: { Count: { type: 'number', description: 'Maximum number of reservations to return' }, Cursor: { type: 'string', description: 'Pagination cursor for next page' } }, description: 'Pagination settings' } }, required: ['StartUtc', 'EndUtc'] },
  • Import statement that brings the getAllReservationsTool into the central tools index module.
    import { getAllReservationsTool } from './reservations/getAllReservations.js';
  • Includes the getAllReservationsTool in the allTools array used for tool registry and lookup.
    getAllReservationsTool,
  • Shared utility function mewsRequest that handles authenticated POST requests to the Mews API, adding auth tokens to the request body, error handling, and response parsing.
    export async function mewsRequest<B = Record<string, unknown>, R = unknown>( config: MewsAuthConfig, endpoint: string, data: B ): Promise<MewsResponse<R>> { const url = `${config.baseUrl}${endpoint}`; const body = { ClientToken: config.clientToken, AccessToken: config.accessToken, Client: config.client, ...data, }; try { const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(body), }); if (!response.ok) { const errorText = await response.text(); throw new Error(`Mews API request failed: ${response.status} ${response.statusText}. ${errorText}`); } // Handle empty responses const contentLength = response.headers.get('content-length'); if (contentLength === '0') { return {} as MewsResponse<R>; } const result = await response.json(); return result as MewsResponse<R>; } catch (error) { if (error instanceof Error) { throw new Error(`Mews API request failed: ${error.message}`); } throw new Error('Unknown error occurred during Mews API request'); }

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/code-rabi/mews-mcp'

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