MCP builds match REST

MCPBreaking

Store names

  • A build with a placeId and a restaurant name now checks every word of the name against the store's name and address, as POST /v1/carts does. A name the store does not carry answers storeMismatch and builds nothing.
  • A build or preview for a name Layout finds no restaurant by answers store_not_found, with nearby restaurants of other names as candidates. Offer them by their own names, and build at one only if the person picks it.
  • In sandbox, a name or test_place_ id that no test restaurant carries answers store_not_found, with the test restaurants as candidates.

See What a preview concluded.

Cancel while building

A build grant can now cancel a cart that is still building: order with action: "status", cancel: true and that build's idempotencyKey answers cancel.status: "canceling". Layout releases the cart as soon as it is built, and never texts the person about it. It works only for a build your application started. See The order actions.

ord_ ids

orderId now takes the ord_ publicOrderId on order_status, confirm and a cancel. A build grant reads only its own application's orders. See The tools.

Ready, expired and canceled carts

  • A ready cart nobody has confirmed, read by orderId, answers placement.status: "carted" with totalMinor, price and expiresAt, where it answered building. It waits on the person, so stop polling it.
  • A cart past its confirm window reads cart_expired by key, and failed with expired: true by orderId, with failureCode: "CART_EXPIRED", where it was OUR_TIMEOUT.
  • A cart the person canceled reads canceled by key.

Confirm totals

A confirm that goes ahead carries totalMinor, the total you confirmed with, fee included; merchantTotalMinor, the restaurant's own total; and subtotalMinor, the food before tax. See Confirm in sandbox.

grant_expired

An expired build grant sent to mcp.layout.link now answers 401 with error.code: "grant_expired", as on api.layout.link. Mint a new grant. Any other refused grant still answers unauthorized. A confirm or resend answered rate_limited now carries retryAfterSec. See MCP refusals.

Build session tools

mcp-tools.json adds buildSessionTools, the tools as a build grant's tools/list returns them. See MCP tools.

Breaking changes

  • A build whose name has a word the store does not carry now answers storeMismatch, where it could build.
  • A build for a name Layout cannot find now answers store_not_found, where it could ask which of several other restaurants.
  • A confirm's subtotalMinor is now the food before tax, not the restaurant's total. Read merchantTotalMinor for that.
  • Polling a ready cart by orderId now gets carted at once, not building.
  • An expired cart reads CART_EXPIRED, not OUR_TIMEOUT.
  • An expired build grant gets grant_expired, not unauthorized.

All changes