Add passenger count options to CLI and MCP#103
Open
kvasdopil wants to merge 2 commits intopunitarani:mainfrom
Open
Add passenger count options to CLI and MCP#103kvasdopil wants to merge 2 commits intopunitarani:mainfrom
kvasdopil wants to merge 2 commits intopunitarani:mainfrom
Conversation
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
children,infants_in_seat, andinfants_on_lapoptions to thefli flightsandfli datesCLI commandssearch_flightsandsearch_datestools and pass them through toPassengerInfoWhy
The Python model layer already supported child and infant passenger counts through
PassengerInfo, but the CLI and MCP surfaces still hardcoded adult-only behavior. That made family search scenarios available in the underlying library but not accessible from the main user-facing entrypoints.Impact
Users can now specify family passenger mixes consistently across the CLI and MCP interfaces, and the docs/examples now show those options only in the places where passenger configuration is directly relevant.
Root Cause
PassengerInfoand the Google Flights encoding already handled the extra passenger fields, but the CLI command builders and MCP parameter models only exposed adult passenger counts.Validation
./.venv/bin/python -m pytest -q tests/cli tests/mcp./.venv/bin/python -m pytest -q tests/models/test_flight_search_filters.py tests/models/test_date_search_filters.py./.venv/bin/python -m ruff check examples/complex_flight_search.py examples/complex_round_trip_validation.pyGreptile Summary
This PR exposes
children,infants_in_seat, andinfants_on_lappassenger fields — which were already supported byPassengerInfoand the Google Flights encoding layer — through thefli flights/fli datesCLI commands and the MCPsearch_flights/search_datestools. Documentation, examples, and test coverage are updated consistently.Key changes:
flights.py,dates.py): three newtyper.Optionparameters plumbed through_search_flights_coreand intoPassengerInfo.server.py): fields added toFlightSearchParams,DateSearchParams, and both tool function signatures with correctge=0Pydantic constraints.test_*_with_family_passenger_countstests in CLI and MCP suites; model encoding tests updated to use distinct adult count (2 → 3) for clearer value differentiation.--passengersCLI option: both CLI commands still hardcodeadults=1with no--passengers/--adultsflag. The MCP already exposes apassengersparameter, so family searches with more than one adult cannot be expressed from the CLI — this gap pre-dates the PR but is left unaddressed by it.dates.py: theexcept (AttributeError, ValueError)handler builds its own inlinequerydict that omits the three new fields, while the adjacentexcept ParseErrorhandler includes them, producing inconsistent JSON error responses.Confidence Score: 5/5
Safe to merge; all findings are P2 style/completeness issues that do not affect runtime correctness of the happy path.
All P2 findings — the missing --passengers CLI option is a pre-existing gap (not introduced by this PR) and the incomplete error-response dict only affects the rarely-hit AttributeError/ValueError JSON error path. Core logic, model encoding, and the full success path are correct and covered by tests. Per guidance, P2-only findings do not reduce the score below 5.
fli/cli/commands/dates.py — the AttributeError/ValueError error handler is missing the new passenger fields in its inline query dict.
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant CLI/MCP participant PassengerInfo participant SearchEngine participant GoogleFlights User->>CLI/MCP: --children N / --infants-in-seat N / --infants-on-lap N CLI/MCP->>PassengerInfo: PassengerInfo(adults=1, children=N, infants_in_seat=N, infants_on_lap=N) PassengerInfo-->>CLI/MCP: validated model CLI/MCP->>SearchEngine: FlightSearchFilters(passenger_info=...) SearchEngine->>GoogleFlights: encode([adults, children, infants_on_lap, infants_in_seat]) GoogleFlights-->>SearchEngine: flight results SearchEngine-->>CLI/MCP: FlightResult[] CLI/MCP-->>User: formatted outputComments Outside Diff (1)
fli/cli/commands/dates.py, line 382-419 (link)The
except (AttributeError, ValueError)handler builds its own inlinequerydict that omitschildren,infants_in_seat, andinfants_on_lap. Theexcept ParseErrorhandler above it (lines 339–379) includes those fields, so the two branches produce inconsistent JSON error responses.When a
ValueErrororAttributeErroris raised during the actual search (e.g. a network timeout re-wrapped asValueError), the caller receives a JSON error response that silently drops the passenger configuration they supplied.Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat: Add passenger count options" | Re-trigger Greptile
(4/5) You can add custom instructions or style guidelines for the agent here!