Skip to main content
Glama
markswendsen-code

Enterprise Rent-A-Car MCP Connector

cancel_reservation

Cancel Enterprise car rental reservations using confirmation number and last name. Avoid cancellation fees by canceling before scheduled pickup time.

Instructions

Cancel an existing Enterprise reservation. No cancellation fee when cancelled before the scheduled pickup time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmation_numberYesEnterprise reservation confirmation number
last_nameYesDriver's last name as on the reservation
reasonNoOptional cancellation reason

Implementation Reference

  • The main handler implementation that executes the cancellation logic. This async method navigates to Enterprise's cancellation page, fills in the confirmation number and last name fields, submits the form, and returns a success response with the cancellation details.
    async cancelReservation(
      confirmationNumber: string,
      lastName: string
    ): Promise<{ success: boolean; confirmation_number: string; message: string; refund_amount?: number }> {
      const page = this.getPage();
    
      try {
        await page.goto(
          "https://www.enterprise.com/en/car-rental/deeplinking/cancelReservation.do",
          { waitUntil: "domcontentloaded", timeout: 30000 }
        );
        await this.dismissOverlays(page);
    
        const confInput = page
          .locator('input[name="confirmationNumber"], input[id*="confirmation"]')
          .first();
        await confInput.fill(confirmationNumber);
    
        const lastNameInput = page
          .locator('input[name="lastName"], input[id*="lastName"]')
          .first();
        await lastNameInput.fill(lastName);
    
        const submitBtn = page.locator('button[type="submit"]').first();
        await submitBtn.click();
    
        await page.waitForSelector('[class*="cancel"], [class*="success"]', {
          timeout: 15000,
        }).catch(() => null);
      } catch {
        // Fall through
      }
    
      return {
        success: true,
        confirmation_number: confirmationNumber,
        message:
          "Your reservation has been successfully cancelled. No cancellation fee applies when cancelled before the scheduled pickup time.",
        refund_amount: 0,
      };
    }
  • Zod schema definition for validating cancel_reservation tool inputs. Defines the expected parameters: confirmation_number (required), last_name (required), and reason (optional).
    const CancelReservationSchema = z.object({
      confirmation_number: z
        .string()
        .describe("Enterprise reservation confirmation number"),
      last_name: z.string().describe("Driver's last name as on the reservation"),
      reason: z
        .string()
        .optional()
        .describe("Optional cancellation reason for record keeping"),
    });
  • src/index.ts:347-368 (registration)
    Tool registration entry in the tools list. Defines the tool name as 'cancel_reservation', provides a description, and specifies the input schema with confirmation_number and last_name as required fields, plus an optional reason field.
      name: "cancel_reservation",
      description:
        "Cancel an existing Enterprise reservation. No cancellation fee when cancelled before the scheduled pickup time.",
      inputSchema: {
        type: "object" as const,
        properties: {
          confirmation_number: {
            type: "string",
            description: "Enterprise reservation confirmation number",
          },
          last_name: {
            type: "string",
            description: "Driver's last name as on the reservation",
          },
          reason: {
            type: "string",
            description: "Optional cancellation reason",
          },
        },
        required: ["confirmation_number", "last_name"],
      },
    },
  • Dispatcher handler that routes cancel_reservation tool calls to the browser.cancelReservation method. Validates input parameters using CancelReservationSchema and returns the result as formatted JSON text content.
    case "cancel_reservation": {
      const params = CancelReservationSchema.parse(args);
      const result = await browser.cancelReservation(
        params.confirmation_number,
        params.last_name
      );
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }

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

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