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
| Name | Required | Description | Default |
|---|---|---|---|
| confirmation_number | Yes | Enterprise reservation confirmation number | |
| last_name | Yes | Driver's last name as on the reservation | |
| reason | No | Optional cancellation reason |
Implementation Reference
- src/browser.ts:728-768 (handler)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, }; } - src/index.ts:124-133 (schema)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"], }, }, - src/index.ts:489-503 (handler)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), }, ], }; }