Skip to main content
Glama

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
NameRequiredDescriptionDefault
bagsYesNumber of checked bags to add (0-4)
passengersNoNumber of passengers (default: 1)

Implementation Reference

  • 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
            ),
          },
        ],
      };
    }
  • 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"],
      },
    },
  • 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,
      };
    }

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/markswendsen-code/mcp-delta'

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