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
| Name | Required | Description | Default |
|---|---|---|---|
| requestBody | Yes | Initial flight search parameters to validate and establish booking session. This creates the foundation for subsequent flight searches. |
Input Schema (JSON Schema)
{
"properties": {
"requestBody": {
"additionalProperties": false,
"description": "Initial flight search parameters to validate and establish booking session. This creates the foundation for subsequent flight searches.",
"properties": {
"commercialFareFamilies": {
"description": "Array of fare family codes to filter search results. Common codes: CFFECO (Economy), CFFBUS (Business), CFFFIR (First). Use airline-specific codes for targeted searches.",
"items": {
"type": "string"
},
"minItems": 1,
"type": "array"
},
"flowCode": {
"default": "Revenue",
"description": "Booking flow context that determines available options and pricing logic",
"enum": [
"Revenue",
"Award",
"Upgrade"
],
"type": "string"
},
"itineraries": {
"description": "Flight segments defining the journey. Single segment = one-way, two segments = round-trip. Each segment represents one flight leg of the complete journey.",
"items": {
"additionalProperties": false,
"properties": {
"departureDate": {
"description": "Departure date in ISO format YYYY-MM-DD (e.g., 2025-09-30). Must be a future date.",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"type": "string"
},
"destinationLocationCode": {
"description": "IATA airport code for arrival city (3 uppercase letters, e.g., SIN for Singapore)",
"maxLength": 3,
"minLength": 3,
"pattern": "^[A-Z]{3}$",
"type": "string"
},
"isRequestedBound": {
"description": "Whether this segment is the primary requested journey. Set true for outbound/main flight, false for return flights in round-trip searches.",
"type": "boolean"
},
"originLocationCode": {
"description": "IATA airport code for departure city (3 uppercase letters, e.g., KUL for Kuala Lumpur)",
"maxLength": 3,
"minLength": 3,
"pattern": "^[A-Z]{3}$",
"type": "string"
}
},
"required": [
"originLocationCode",
"destinationLocationCode",
"departureDate",
"isRequestedBound"
],
"type": "object"
},
"maxItems": 10,
"minItems": 1,
"type": "array"
},
"selectedBoundId": {
"description": "Optional identifier for pre-selected outbound flight in round-trip bookings. Used when customer has already chosen their outbound flight and is now selecting return options.",
"type": "string"
},
"travelers": {
"description": "List of all passengers for the booking. Each traveler object represents one person. Total count affects pricing and availability. Maximum 9 passengers per booking.",
"items": {
"additionalProperties": false,
"properties": {
"passengerTypeCode": {
"description": "Type of passenger for pricing and service determination",
"enum": [
"ADT",
"CHD",
"INF"
],
"type": "string"
}
},
"required": [
"passengerTypeCode"
],
"type": "object"
},
"maxItems": 9,
"minItems": 1,
"type": "array"
}
},
"required": [
"commercialFareFamilies",
"itineraries",
"travelers"
],
"type": "object"
}
},
"required": [
"requestBody"
],
"type": "object"
}
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, ); }, ); }