Skip to main content
Glama
hrz8
by hrz8

initialize_booking_session

Start a new flight booking session by providing travel details including routes, dates, passengers, and fare preferences to search for available flights.

Instructions

Initialize a new booking session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestBodyYesInitial flight search parameters to validate and establish booking session. This creates the foundation for subsequent flight searches.

Implementation Reference

  • Registration of the initialize_booking_session MCP tool, defining its metadata, input schema reference, API endpoint (/initialisation POST), security requirements, and custom response serializer that extracts the session token and formats the initialization success message.
    [ 'initialize_booking_session', { name: 'initialize_booking_session', description: 'Initialize a new booking session.', inputSchema: InitializeBookingSchema, method: 'post', pathTemplate: '/initialisation', executionParameters: [], requestBodyContentType: 'application/json', securityRequirements: [ { HeaderApiToken: [], HeaderApimSubscriptionKey: [], HeaderApiVersion: [], }, ], serializer: (response: AxiosResponse): string => { const sessionToken = response.headers['session-token']; let output = 'BOOKING SESSION INITIALIZED\n'; output += '='.repeat(80) + '\n\n'; if (sessionToken) { output += `Session Token: ${sessionToken}\n`; output += '(Token has been captured and will be used automatically for subsequent requests)\n\n'; } output += 'Status: Ready\n'; output += 'Next step: Use search_flights tool to find available flights\n'; return output; }, },
  • Zod schema defining the input structure for initialize_booking_session, which requires a requestBody containing flight search parameters (itineraries, travelers, etc.) to initialize the booking session.
    export const InitializeBookingSchema = z.object({ requestBody: FlightSearchBodySchema .describe('Initial flight search parameters to validate and establish booking session. This creates the foundation for subsequent flight searches.'), }).describe('REQUIRED FIRST STEP: Initialize booking session with airline system. Call this endpoint first to receive a session token, then use that token for actual flight searches. The session token will be returned in the response headers and must be captured for the next step.');
  • Registers all tools from the tools map (including initialize_booking_session) with the MCP Server by handling ListToolsRequest and CallToolRequest, converting schemas to MCP format and executing via executeApiTool.
    export function registerTools(server: Server): void { server.setRequestHandler(ListToolsRequestSchema, async () => { const toolsForClient: Tool[] = []; for (const def of Array.from(tools.values())) { toolsForClient.push({ name: def.name, description: def.description, inputSchema: zodToMcpJsonSchema(def.inputSchema), }); } return { tools: toolsForClient, }; }); server.setRequestHandler( CallToolRequestSchema, async (request: CallToolRequest): Promise<CallToolResult> => { const { name: toolName, arguments: toolArgs } = request.params; console.info(`Attempt to use custom tool: ${toolName}`); const toolDefinition = tools.get(toolName); if (!toolDefinition) { return { content: [ { type: 'text', text: `Error: Unknown tool requested: ${toolName}`, }, ], }; } return await executeApiTool( toolName, toolDefinition, toolArgs ?? {}, securitySchemes, ); }, ); }

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/hrz8/mcp-openapi'

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