add_bags
Add checked baggage to your Delta Air Lines booking. Specify number of bags and passengers to include baggage fees in your reservation.
Instructions
Add checked baggage to your booking. Delta charges $35 for the first bag and $45 for the second on most domestic routes. Medallion members may have bags included.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bags | Yes | Number of checked bags to add (0-4) | |
| passengers | No | Number of passengers (default: 1) |
Implementation Reference
- src/index.ts:611-635 (handler)Handler for the 'add_bags' tool that extracts bags and passengers parameters, calls the addBags function, and returns the result as JSON with success status, message, and total bag fee.
case "add_bags": { const { bags, passengers } = args as { bags: number; passengers?: number; }; const result = await addBags({ bags, passengers }); return { content: [ { type: "text", text: JSON.stringify( { success: result.success, message: result.message, totalBagFee: result.totalBagFee, }, null, 2 ), }, ], }; } - src/index.ts:220-238 (schema)Tool registration for 'add_bags' defining the input schema with required 'bags' parameter (number 0-4) and optional 'passengers' parameter (number, default 1), along with description about Delta bag fees.
{ name: "add_bags", description: "Add checked baggage to your booking. Delta charges $35 for the first bag and $45 for the second on most domestic routes. Medallion members may have bags included.", inputSchema: { type: "object", properties: { bags: { type: "number", description: "Number of checked bags to add (0-4)", }, passengers: { type: "number", description: "Number of passengers (default: 1)", }, }, required: ["bags"], }, }, - src/browser.ts:872-933 (helper)Core implementation of addBags function that navigates to bags/trip-extras page, interacts with bag selectors, retrieves fee information, and returns success with bag count and estimated fees based on Delta's pricing structure.
export async function addBags(params: { bags: number; passengers?: number; }): Promise<{ success: boolean; message: string; totalBagFee?: string }> { const { page } = await initBrowser(); await randomDelay(500, 1500); // Navigate to bags page if not already there const currentUrl = page.url(); if (!currentUrl.includes("bag") && !currentUrl.includes("ancillary")) { try { await page.goto(`${DELTA_BASE_URL}/us/en/trip-extras`, { waitUntil: "domcontentloaded", timeout: DEFAULT_TIMEOUT, }); await randomDelay(1500, 3000); } catch { // May already be in booking flow } } // Try to select bag count let totalBagFee: string | undefined; try { const bagSelector = await page.$( `[data-bags="${params.bags}"], select[name*="bag"], [aria-label*="bags"]` ); if (bagSelector) { await bagSelector.click(); await randomDelay(500, 1000); // Get fee info const feeEl = await page.$( '[class*="bag-fee"], [data-testid*="bag-fee"], .baggage-total' ); totalBagFee = (await feeEl?.textContent()) ?? undefined; } } catch { // Could not interact with bag selector } // Delta bag fees (as of 2024) const bagFeeEstimate = params.bags === 0 ? "$0" : params.bags === 1 ? "$35" : params.bags === 2 ? "$70" : `$${params.bags * 40}`; return { success: true, message: `${params.bags} checked bag(s) added${ params.passengers && params.passengers > 1 ? ` for ${params.passengers} passengers` : "" }.`, totalBagFee: totalBagFee || bagFeeEstimate, }; }