feat(mcp): expose children and infant passenger counts - #194
Conversation
The MCP tool layer only surfaced a single `passengers` field and hardcoded `PassengerInfo(adults=params.passengers)`, dropping the library's existing `children`, `infants_in_seat`, and `infants_on_lap` support. Families could not be priced correctly. Add `children`, `infants_in_seat`, and `infants_on_lap` (all default 0) to `FlightSearchParams` and `DateSearchParams`, to the `search_flights`, `search_dates`, and `get_booking_options` tool signatures, and pass them through to both `PassengerInfo` construction sites. Adult-only callers are unaffected (new fields default to 0). Add passenger-mix tests asserting the counts flow into the constructed filters for both flight and date search.
get_booking_options builds its own FlightSearchParams and re-runs the search via _build_flight_filters rather than delegating to _search_flights_from_params, so a passenger-field omission on that path was untested. Add test_booking_options_passenger_mix via the existing _get_booking_options_from_params entry point.
|
This fills a real gap —
(FWIW the Greptile note about a missing booking-options test looks stale relative to the final diff — |
The MCP tool layer only surfaced a single
passengersfield and hardcodedPassengerInfo(adults=params.passengers), dropping the library's existingchildren,infants_in_seat, andinfants_on_lapsupport. Families could not be priced correctly.Add
children,infants_in_seat, andinfants_on_lap(all default 0) toFlightSearchParamsandDateSearchParams, to thesearch_flights,search_dates, andget_booking_optionstool signatures, and pass them through to bothPassengerInfoconstruction sites. Adult-only callers are unaffected (new fields default to 0).Add passenger-mix tests asserting the counts flow into the constructed filters for both flight and date search.
Greptile Summary
This PR exposes
children,infants_in_seat, andinfants_on_lappassenger counts through the MCP tool layer, fixing a gap where those fields existed inPassengerInfobut were never reachable fromsearch_flights,search_dates, orget_booking_options. The new fields default to0, keeping all existing adult-only callers unaffected.FlightSearchParamsandDateSearchParamsgain three newintfields withge=0constraints; both_build_flight_filtersand_execute_date_searchnow forward them intoPassengerInfo.search_flights,search_dates,get_booking_options) gain matchingAnnotatedparameters that are wired into the params objects.TestPassengerMixclass covers flight-search and date-search passenger mix;get_booking_optionsshares the same_build_flight_filterscode path but has no dedicated passenger-mix test."Confidence Score: 4/5
The change is safe to merge; it adds opt-in fields that default to zero and threads them through two symmetric code paths that are both exercised by the new tests.
The wiring is correct and symmetric across all three tools. The only gap is that the get_booking_options passenger-mix path, while using the same _build_flight_filters function, has no dedicated test to catch a future accidental mismatch in how those parameters are passed into FlightSearchParams from that tool body.
No files require special attention, though a glance at the get_booking_options parameter-to-FlightSearchParams construction block (around line 1331) is worthwhile during final review.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client as MCP Client participant Tool as MCP Tool participant Params as FlightSearchParams / DateSearchParams participant Builder as _build_flight_filters / _execute_date_search participant PI as PassengerInfo participant Search as SearchFlights / SearchDates Client->>Tool: adults, children, infants_in_seat, infants_on_lap Tool->>Params: construct with all 4 fields Params->>Builder: params object Builder->>PI: PassengerInfo(adults, children, infants_in_seat, infants_on_lap) Builder->>Search: FlightSearchFilters / DateSearchFilters with populated PassengerInfo Search-->>Client: flight results / date resultsPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat(mcp): expose children and infant pa..." | Re-trigger Greptile