Repository navigation
Option groups: join the option library, read Wolt's ranges, accept options in wolt_cart_add - #69
Merged
Merged
Conversation
…ions in wolt_cart_add
Wolt's assortment keeps a dish's option groups in two places. The item-level
entry carries the dish-specific name, the selection range under
multi_choice_config.total_range and prerequisite_values; the venue library
entry it points at through option_id carries the values, their prices and
default_value.
- payloadutil.JoinOptionLibrary joins the two. catalogitem.ScopedItem and the
item detail builder use it, so wolt_venue_item (MCP) now returns the values
instead of empty groups. The CLI item payload uses the same join.
- ExtractOptionSpecs reads multi_choice_config (min, max,
max_single_selections), per-value maxima, default_value and
prerequisite_values. required is true when min >= 1; before, every group
came out as min 0, max 0, not required, in both CLI and MCP.
- Item detail marks the default value, lists prerequisite_value_ids and the
library_group_id, and adds default_price: the base price plus the defaults
of the required groups, which is what the Wolt app shows.
- New package itemoptions holds option validation and pricing for both the
CLI and MCP. A required group left without a choice gets its default value,
as the Wolt app preselects it (an order history line confirms this); optional
defaults are never applied, because Wolt names paid extras as defaults. A
group with prerequisites applies only while one of them is selected.
Per-value limits are enforced. The applied defaults are reported as
default_options.
- wolt_cart_add takes options [{group_id, value_id, count}] and prices the
line with them, replacing the guard that refused every item with a required
group (which never fired, since no group was ever seen as required).
Checked live on Taco Bell Finnoo: a meal with five required groups added with
one explicit paid drink was accepted; Wolt's basket total and checkout item
subtotal matched the CLI line price, and an MCP add of the same configuration
merged into the line.
Fixes #65
Fixes #66
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restaurant dishes with options were described wrongly in both the CLI and the MCP server. The MCP tool
wolt_venue_itemshowed every option group with no values. Both surfaces showed every group as optional with a range of 0 to 0. As a result, a dish with a required, paid choice showed only its base price.wolt_cart_addcould also add such a dish with no options at all, and an MCP client had no way to pick options.Now both surfaces show each group's values, prices, limits and default value. They also show the price with the required defaults, the price the Wolt app shows. When a required group is left out,
wolt cart addandwolt_cart_adduse its default value, just as the Wolt app preselects it.wolt_cart_addaccepts option choices and includes their prices in the line price.Nothing needed from you.
Fixes #65
Fixes #66
Details
multi_choice_config.total_rangeandprerequisite_values. The venue library entry, linked byoption_id, has the values, prices anddefault_value.payloadutil.JoinOptionLibraryjoins them for the MCP item path (catalogitem.ScopedItem), for the item detail builder, and for the CLI item payload.ExtractOptionSpecsreads the range,max_single_selections, per-value maxima,default_valueandprerequisite_values.internal/service/itemoptionsvalidates and prices option choices for both surfaces. Defaults apply only to required groups. Wolt also names defaults for optional groups, often a paid extra such as "Add Ingredients: beef +1.50", and the app does not preselect those: a past order line keeps the required salsa default and leaves the optional extra out. A group with prerequisites applies only while one of its prerequisite values is selected. This is common: 410 such groups across six Espoo venues checked, 83 of them required.free_selections(the first N selections free) is 0 on every one of the 1,377 groups checked, so it is not applied.Live check
Taco Bell Finnoo, "Grilled Cheese Triple Layer Crunchwrap Meal" (16.99 €), with five required groups.
wolt cart add --count 2picked one paid drink, Dr Pepper at +2.00 €, and four defaults filled the rest. Wolt accepted the line, and its basket total was 37.98 €.wolt_cart_addwith the same drink merged into that line, taking it to 3 × 18.99 € = 56.97 €. Wolt's checkout preview showed "Item subtotal €56.97". The test line was removed afterwards.wolt_venue_itemon Burger King Finnoo "Ultimate Chili Cheese Plant-based" now returnsdefault_price13.95 €: 11.45 € plus the required 2.50 € cheddar dip.