Skip to main content
Glama

change_flight

Modify Southwest Airlines bookings to change dates, routes, or airports. Only pay fare differences with no change fees required.

Instructions

Modify an existing Southwest booking. Southwest never charges change fees — you only pay/receive credit for fare differences.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmationNumberYes6-character booking confirmation number
firstNameYesPassenger first name
lastNameYesPassenger last name
newDepartureDateNoNew departure date YYYY-MM-DD (for outbound flight change)
newReturnDateNoNew return date YYYY-MM-DD (for return flight change)
newOriginAirportNoNew origin airport code (if changing route)
newDestinationAirportNoNew destination airport code (if changing route)

Implementation Reference

  • The main handler function 'changeFlight' that executes the change flight tool logic. It navigates to Southwest's manage reservation page, fills in confirmation number and passenger details, finds and clicks the change flight button, and allows updating departure/return dates and origin/destination airports.
    export async function changeFlight(input: ChangeFlightInput) {
      const page = await getPage();
    
      // Navigate to manage reservation
      await page.goto(
        "https://www.southwest.com/air/manage-reservation/index.html",
        { waitUntil: "networkidle" }
      );
    
      await page.fill(
        '[data-qa="confirmation-number"], [name="confirmationNumber"]',
        input.confirmationNumber.toUpperCase()
      );
      await page.fill('[data-qa="first-name"], [name="firstName"]', input.firstName);
      await page.fill('[data-qa="last-name"], [name="lastName"]', input.lastName);
    
      await page.click('[data-qa="search-button"], [data-qa="retrieve-button"]');
      await page.waitForNavigation({ waitUntil: "networkidle" }).catch(() => {});
    
      // Find and click the "Change Flight" button
      const changeButton = page.locator(
        '[data-qa="change-flight-btn"], [data-qa*="change"], a[href*="change"]'
      );
      const changeAvailable = await changeButton.isVisible().catch(() => false);
    
      if (!changeAvailable) {
        return {
          success: false,
          message:
            "Change flight option not found. The flight may be within 10 minutes of departure or may not be eligible for changes.",
        };
      }
    
      await changeButton.first().click();
      await page.waitForNavigation({ waitUntil: "networkidle" }).catch(() => {});
    
      // Fill in new flight search if dates provided
      if (input.newDepartureDate) {
        await page
          .fill(
            '[data-qa="new-departure-date"], [name*="departureDate"]',
            input.newDepartureDate
          )
          .catch(() => {});
      }
      if (input.newOriginAirport) {
        await page
          .fill(
            '[data-qa="origin-airport"], [name*="origin"]',
            input.newOriginAirport.toUpperCase()
          )
          .catch(() => {});
      }
      if (input.newDestinationAirport) {
        await page
          .fill(
            '[data-qa="destination-airport"], [name*="destination"]',
            input.newDestinationAirport.toUpperCase()
          )
          .catch(() => {});
      }
    
      // Search for new flights
      await page.click('[data-qa="search-button"], [data-qa="find-flights"]').catch(() => {});
      await page.waitForNavigation({ waitUntil: "networkidle" }).catch(() => {});
    
      const flightsAvailable = await page
        .locator('[data-qa="flight-card"]')
        .isVisible()
        .catch(() => false);
    
      return {
        success: true,
        confirmationNumber: input.confirmationNumber.toUpperCase(),
        message: flightsAvailable
          ? "Available flights for your change are now shown. Southwest charges no change fees — you only pay (or receive credit for) any fare difference."
          : "Change flight page loaded. Please review available options.",
        noChangeFee: true,
        note: "Southwest Airlines never charges change fees. If the new fare is lower, you'll receive a travel fund credit. If higher, you pay the difference.",
        currentUrl: page.url(),
      };
    }
  • The Zod schema 'changeFlightSchema' defining input validation with confirmation number, first/last name, optional new departure/return dates, and optional new origin/destination airport codes. Also exports the TypeScript type 'ChangeFlightInput'.
    export const changeFlightSchema = z.object({
      confirmationNumber: z
        .string()
        .describe("6-character booking confirmation number"),
      firstName: z.string().describe("Passenger first name"),
      lastName: z.string().describe("Passenger last name"),
      newDepartureDate: z
        .string()
        .optional()
        .describe("New departure date YYYY-MM-DD (for outbound flight change)"),
      newReturnDate: z
        .string()
        .optional()
        .describe("New return date YYYY-MM-DD (for return flight change)"),
      newOriginAirport: z
        .string()
        .length(3)
        .optional()
        .describe("New origin airport code (if changing route)"),
      newDestinationAirport: z
        .string()
        .length(3)
        .optional()
        .describe("New destination airport code (if changing route)"),
    });
    
    export type ChangeFlightInput = z.infer<typeof changeFlightSchema>;
  • src/index.ts:133-138 (registration)
    Tool registration in the TOOLS array that defines 'change_flight' with its description about Southwest's no change fee policy and references the changeFlightSchema for input validation.
    {
      name: "change_flight",
      description:
        "Modify an existing Southwest booking. Southwest never charges change fees — you only pay/receive credit for fare differences.",
      inputSchema: zodToJsonSchema(changeFlightSchema),
    },
  • The switch case in the CallToolRequestSchema handler that dispatches 'change_flight' tool calls to the changeFlight function after parsing arguments with the schema.
    case "change_flight":
      result = await changeFlight(changeFlightSchema.parse(args));
      break;
  • src/index.ts:29-29 (registration)
    Import statement that brings in the changeFlight handler and changeFlightSchema from the tools/change-flight.js module.
    import { changeFlight, changeFlightSchema } from "./tools/change-flight.js";
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states that modifications involve fare differences (pay/receive credit), which hints at financial implications, but does not cover other critical aspects like authentication needs, rate limits, error handling, or what the tool returns. For a mutation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded with the core purpose in the first sentence. The second sentence adds valuable context about fare policies without redundancy. Both sentences earn their place, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with 7 parameters), lack of annotations, and no output schema, the description is incomplete. It fails to explain behavioral traits like what happens on success/failure, return values, or prerequisites. The fare difference note is helpful but insufficient for a tool that modifies bookings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents all 7 parameters thoroughly. The description does not add any parameter-specific details beyond what the schema provides, such as explaining interactions between parameters (e.g., how new dates relate to route changes). Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Modify an existing Southwest booking.' It specifies the verb ('modify') and resource ('Southwest booking'), but does not explicitly differentiate it from sibling tools like 'cancel_flight' or 'get_reservation' beyond the general action. The mention of fare differences adds context but not sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions that Southwest doesn't charge change fees, which is useful context, but does not specify prerequisites, exclusions, or compare it to siblings like 'cancel_flight' or 'select_flight' for booking modifications.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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-southwest'

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