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
| Name | Required | Description | Default |
|---|---|---|---|
| requestBody | Yes | Initial flight search parameters to validate and establish booking session. This creates the foundation for subsequent flight searches. |
Implementation Reference
- src/mcp/tools/tools.ts:9-42 (registration)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; }, },
- src/mcp/tools/input-schema.ts:54-57 (schema)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.');
- src/mcp/tools/index.ts:9-51 (registration)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, ); }, ); }