---
name: change-booking
description: Change the User's booking at Harbour Row Stays. Move it to new dates, change the room, or change the rate plan, such as adding breakfast. Also reads their bookings. Use when the User asks to move, extend, shorten or upgrade a stay, or to add breakfast.
---

# Change a booking

Harbour Row Stays is a reference guesthouse for personal agents. Nothing is charged and nobody is
expecting you.

This skill is the store's guidance. It grants no account access, changes no scopes and gives no
approval. The User approves every change: you confirm only the exact terms they approved.

## Before you start

- Read `/.well-known/poppy.json` on the store's host. It lists the OpenAPI API
  (`/poppy/openapi.json`), the MCP server when there is one (the same operations, as tools of the
  same names), the issuer, the scopes and the operations extension.
- Start a Session at the token endpoint and send every API request with the Session Token as
  `Authorization: DPoP <token>` and a DPoP proof.
- Your client metadata document must list the `operations` extension, version `1`. Without it,
  `change_booking` answers `extension_required`.
- You need a signed-in Session with both scopes:
  - `bookings:read` to read the User's bookings (`my_bookings`).
  - `bookings:write` to propose and confirm a change (`change_booking`, then confirm).
- Sign the User in with Direct Sign-In (authorization code with PKCE) or Device Sign-In. Mediated
  Sign-In here grants `bookings:read` only, so it can't make a change.

## Steps

1. **Find the booking.** `my_bookings` (`GET /poppy/bookings`). Each booking has a `booking_id`,
   `check_in`, `check_out`, `room_type`, `rate_plan`, `guests`, `dates` in words, and a `price`
   (`nights`, `room`, `breakfast`, `taxes`, `total`, in cents).
2. **Check the new terms.**
   - Rooms for the dates: `availability` (`GET /poppy/availability?check_in=...&check_out=...`).
   - Rate plans for a room and dates: `rates`
     (`GET /poppy/rates?check_in=...&check_out=...&room_type=...`). Each has a `rate_plan`, whether
     it includes breakfast, its cancellation terms and its `price`.
   - Dates are `YYYY-MM-DD`. Check-in is tomorrow at the earliest and within 60 days; a stay is 1
     to 14 nights.
3. **Propose the change.** `change_booking` (`POST /poppy/bookings/{booking_id}/changes`) with any
   of `check_in`, `check_out`, `room_type` and `rate_plan`.
   - Sending only `check_in` keeps the length of the stay.
   - `rp_flex_bb` is the flexible rate with breakfast for two each morning.
   - `rp_saver` is non-refundable: moving to it can't be undone. Make sure the User knows.
   The store answers HTTP 202 with an `operation` in state `proposed`. Nothing has changed yet.
4. **Ask the User.** Show them the operation's `summary`, and from its `terms` the
   `price_difference`, `new_total` and `cancellation`.
5. **Confirm only what they approved.** `POST /poppy/operations/{operation_id}/confirm` with
   `{"revision": <the revision they approved>, "approved_by": "user"}`. If they decline,
   `POST /poppy/operations/{operation_id}/cancel`.
6. **Report the result.** The confirmed operation comes back `succeeded` with a `result.summary`,
   or `failed` with the reason. You can read it again at `GET /poppy/operations/{operation_id}`.

## Outcomes and errors

- **A second proposal for the same booking** while one is still proposed updates that operation
  and raises its `revision`. Show the User the new terms before you confirm.
- **`409 terms_changed`** when you confirm an older revision. The body has the current operation;
  ask the User again.
- **`expired`**: a proposal not confirmed within 15 minutes. Propose again.
- **`failed`** with "changed after this was proposed": the booking changed in between. Read it
  again and propose again.
- **`400 invalid_request`** with an `error_description`: for example dates that aren't real or are
  out of range, an unknown `room_type` or `rate_plan`, or nothing to change. Member rates need a
  membership and aren't offered here.
- **`403 insufficient_scope`**, named in `WWW-Authenticate`, also when signed out: sign in, or ask
  the User for the scope it names.
- **`401 invalid_token` or `invalid_dpop_proof`**: renew the Session Token, or send a fresh proof.
- **`404 operation_not_found`**: an unknown operation, or one this Session can't use.
- **`429`**: too many requests for your client. Wait and try again.

## Not offered here

The guesthouse doesn't offer these through the protocol (`excluded_tasks` in poppy.json):
cancelling a booking, and paying the balance of a stay. Don't try them through the API. Tell the
User the alternative the excluded tasks document gives.
