get_offer_details
Retrieve comprehensive flight offer details using a unique identifier to access pricing, itinerary, and booking information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| offerId | Yes | Unique identifier for the flight offer |
Implementation Reference
- src/server.ts:119-136 (handler)The handler function that executes the tool logic: fetches the flight offer details via flightClient.getOffer(params.offerId) and returns a MCP-formatted text content block with the JSON response.async (params: OfferDetails) => { try { const response = await flightClient.getOffer(params.offerId); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2) } ] }; } catch (error) { console.error(`Error getting offer details: ${error}`); throw error; } }
- src/server.ts:116-137 (registration)Registration of the 'get_offer_details' tool using server.tool with schema and inline handler function.server.tool( 'get_offer_details', offerDetailsSchema.shape, async (params: OfferDetails) => { try { const response = await flightClient.getOffer(params.offerId); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2) } ] }; } catch (error) { console.error(`Error getting offer details: ${error}`); throw error; } } );
- src/models/flightSearch.ts:37-41 (schema)Zod schema defining the input parameters for the tool: offerId as a string.export const offerDetailsSchema = z.object({ offerId: z.string().describe('Unique identifier for the flight offer') }); export type OfferDetails = z.infer<typeof offerDetailsSchema>;
- src/api/duffelClient.ts:210-223 (helper)Supporting utility method in DuffelClient that performs the actual API call to retrieve offer details from Duffel API.async getOffer(offerId: string): Promise<any> { try { if (!offerId.startsWith('off_')) { throw new Error('Invalid offer ID format - must start with "off_"'); } const response = await this.client.get(`/offers/${offerId}`); return response.data; } catch (error) { console.error(`Error getting offer ${offerId}: ${error}`); throw error; } }