Skip to main content
Glama

get_offer_details

Retrieve detailed information about a specific flight offer from the Duffel API, including pricing, itinerary, and accommodation options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
offerIdYesUnique identifier for the flight offer

Implementation Reference

  • The MCP tool registration and inline handler implementation for 'get_offer_details'. It takes an offerId parameter and fetches the detailed offer information from the Duffel API client, returning the JSON response.
    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; } } );
  • Zod schema and TypeScript type definition for the input parameters of the 'get_offer_details' tool, requiring a single 'offerId' string.
    export const offerDetailsSchema = z.object({ offerId: z.string().describe('Unique identifier for the flight offer') }); export type OfferDetails = z.infer<typeof offerDetailsSchema>;
  • The DuffelClient.getOffer helper method that performs the actual API request to retrieve detailed information for a specific flight offer by ID.
    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; } }

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/AkekaratP/flights-mcp-ts'

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