Skip to content

wolt-mcp: option groups come back without values, min, max or required, so prices and the cart_add guard are wrong #65

Closed

Description

@terranalon

wolt_venue_item (and the menu items) return every option group with values: [], min: 0, max: 0 and required: false. The CLI's wolt venue item returns the values for the same item, but its min/max/required are also wrong.

Repro (no login needed), on any restaurant item that has option groups, ideally one with a required single-choice group:

wolt_venue_item  venue=<venue-slug>  item_id=<item-id>
  • MCP: every group has empty values, min: 0, max: 0, required: false. Same with and without a logged-in profile.
  • CLI (wolt venue item <venue-slug> <item-id> --format json): the groups have their values, but still min: 0, max: 0, required: false.

I left out the real venue and item on purpose. I can share them privately if you need them to reproduce this.

What the catalog actually sends (POST .../assortment/items with that item id):

{
  "items": [{
    "id": "<item-id>",
    "price": <base-price>,
    "options": [{
      "id": "<item-option-id>",
      "option_id": "<library-option-id>",
      "name": "<group name>",
      "multi_choice_config": { "total_range": { "min": 1, "max": 1 } }
    }]
  }],
  "options": [{
    "id": "<library-option-id>",
    "type": "choice",
    "default_value": "<value-id>",
    "values": [{ "id": "<value-id>", "name": "<value name>", "price": <option-price> }]
  }]
}
  • The item's options[] entries carry the range under multi_choice_config.total_range, not as top-level min/max.
  • Each item option points to a root options[] library entry by option_id. The library entry holds the values and a default_value.

payloadutil.ExtractOptionSpecs reads min/minimum/min_select and max/maximum/max_select at the top level of the group (payloadutil.go:640-645), so every range comes out as 0 and nothing is required. The MCP handler (handleVenueItem, tools_venue.go:582) also never joins the item option's option_id to the library entry. The CLI gets the values because resolveVenueItemPayloadBySlug merges the full venue assortment (buildItemPayloadFromAssortment), but that code lives in internal/cli, which the MCP server doesn't import.

Effects:

  1. MCP clients see no option values, so they can't choose or price options.
  2. An item whose price depends on a required option shows only its base price. When a required group (min: 1) has a single value priced <option-price>, the real price is <base-price> + <option-price>, which is what the Wolt app shows; the tools show <base-price>.
  3. The guard in wolt_cart_add that refuses items with required options (tools_cart.go:267-276) never fires, because no group is ever seen as required. Such an item is added with options: [] at its base price.

Suggested fix:

  • In ExtractOptionSpecs, read multi_choice_config.total_range.min/max and treat min >= 1 as required.
  • Join item options to the root library by option_id, and carry default_value through as a default flag on the value.
  • Share the assortment merge between the CLI and the MCP item handler, for example by moving buildItemPayloadFromAssortment into a service package.
  • Optionally return an effective price: base price plus the default values of required groups.

Happy to send a PR for this if you'd take one.

Activity

  1. mekedron commented on Nov 13, 2026

    @mekedron
    Owner

    Thanks for the detailed report — fixed in v2.6.0 (#69). wolt_venue_item and wolt venue item now join each item-level group to its library entry, read multi_choice_config.total_range, mark the default value, list prerequisite_value_ids, and add default_price (base price plus the defaults of the required groups).

  2. mekedron commented on Nov 13, 2026

    @mekedron
    Owner

    @terranalon thanks for the offer of a PR, and for the very precise pointers (payloadutil.go, tools_venue.go, the option_id join). They made this quick to fix, so no PR needed this time.

    One thing beyond your suggestions: prerequisite_values turned out to matter a lot. Many required groups (meal deals especially) apply only after a value of another group is chosen. The item output now lists them as prerequisite_value_ids, and validation ignores such a group until its prerequisite is selected.

    If you still have the venue you left out of the report, please try v2.6.0 on it. If anything still looks off, reopen this or file a new issue.

  3. terranalon commented on Nov 14, 2026

    @terranalon
    Author

    Thanks for the quick fix. I tried v2.6.0 on the venue from the report. Values, min/max/required, prerequisite_value_ids, default_price and the options argument on wolt_cart_add all match what the Wolt web app shows.

    One small thing left: wolt_venue_item marks default: true on values in optional groups too (min: 0). On one item, four optional groups (two removals and two paid extras) each had a value flagged as default. The web app preselects only the defaults of required groups, so all four come up unchecked there, and the app's price equals default_price.

    The cause is in extractOptionGroups (internal/service/observability/items.go:228), which flags the library's default_value whatever the group's minimum. itemoptions.Build applies a default only when minimum(spec) == 1 and the group is active, which is right, so baskets and default_price aren't affected. The risk is an agent reading the flags as "the usual order" and passing them to wolt_cart_add, which would add the paid extras and the removals.

    Suggested fix: set default: true only when the group's minimum is at least 1, the same condition Build uses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions