Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ The MCP server provides two main tools:
| `airlines` | list | Filter by airline codes (e.g., ['BA', 'AA']) |
| `sort_by` | string | CHEAPEST, DURATION, DEPARTURE_TIME, or ARRIVAL_TIME |
| `passengers` | int | Number of adult passengers |
| `children` | int | Number of child passengers |
| `infants_in_seat` | int | Number of infants traveling in their own seat |
| `infants_on_lap` | int | Number of lap infants |

#### `search_dates` Parameters

Expand All @@ -82,6 +85,9 @@ The MCP server provides two main tools:
| `airlines` | list | Filter by airline codes (e.g., ['BA', 'AA']) |
| `sort_by_price` | bool | Sort results by price (lowest first) |
| `passengers` | int | Number of adult passengers |
| `children` | int | Number of child passengers |
| `infants_in_seat` | int | Number of infants traveling in their own seat |
| `infants_on_lap` | int | Number of lap infants |

## Quick Start

Expand Down Expand Up @@ -185,6 +191,10 @@ fli dates JFK LHR \
| `--class, -c` | Cabin class | `ECONOMY`, `BUSINESS` |
| `--stops, -s` | Maximum stops | `NON_STOP`, `ONE_STOP` |
| `--sort, -o` | Sort results by | `CHEAPEST`, `DURATION` |
| `--passengers` | Number of adult passengers | `2` |
| `--children` | Number of children | `2` |
| `--infants-in-seat` | Number of infants in seat | `1` |
| `--infants-on-lap` | Number of infants on lap | `1` |
| `--format` | Output format | `text`, `json` |

#### Dates Command (`fli dates`)
Expand All @@ -200,6 +210,10 @@ fli dates JFK LHR \
| `--stops, -s` | Maximum stops | `NON_STOP`, `ONE_STOP` |
| `--time` | Departure time window | `6-20` |
| `--sort` | Sort by price | (flag) |
| `--passengers` | Number of adult passengers | `2` |
| `--children` | Number of children | `2` |
| `--infants-in-seat` | Number of infants in seat | `1` |
| `--infants-on-lap` | Number of infants on lap | `1` |
| `--[day]` | Day filters | `--monday`, `--friday` |
| `--format` | Output format | `text`, `json` |

Expand Down
7 changes: 7 additions & 0 deletions docs/api/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ Type of trip for flight search.

Configuration for passenger counts.

Fields:

- `adults`
- `children`
- `infants_in_seat`
- `infants_on_lap`

::: fli.models.google_flights.PassengerInfo

### TimeRestrictions
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ filters = FlightSearchFilters(
passenger_info=PassengerInfo(
adults=2,
children=1,
infants_in_seat=1,
infants_on_lap=1
),
flight_segments=[
Expand Down Expand Up @@ -280,6 +281,7 @@ filters = FlightSearchFilters(
passenger_info=PassengerInfo(
adults=2,
children=1,
infants_in_seat=1,
infants_on_lap=1
),
flight_segments=[outbound, return_flight],
Expand Down
6 changes: 6 additions & 0 deletions docs/guides/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ Search for flights between two airports on a specific date.
| `airlines` | list | No | null | Filter by airline codes (e.g., ['BA', 'AA']) |
| `sort_by` | string | No | CHEAPEST | CHEAPEST, DURATION, DEPARTURE_TIME, or ARRIVAL_TIME |
| `passengers` | int | No | 1 | Number of adult passengers |
| `children` | int | No | 0 | Number of child passengers |
| `infants_in_seat` | int | No | 0 | Number of infants traveling in their own seat |
| `infants_on_lap` | int | No | 0 | Number of lap infants |

**Example Response:**

Expand Down Expand Up @@ -126,6 +129,9 @@ Find the cheapest travel dates between two airports within a date range.
| `airlines` | list | No | null | Filter by airline codes (e.g., ['BA', 'AA']) |
| `sort_by_price` | bool | No | false | Sort results by price (lowest first) |
| `passengers` | int | No | 1 | Number of adult passengers |
| `children` | int | No | 0 | Number of child passengers |
| `infants_in_seat` | int | No | 0 | Number of infants traveling in their own seat |
| `infants_on_lap` | int | No | 0 | Number of lap infants |

**Example Response:**

Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ from fli.models import PassengerInfo
PassengerInfo(adults=1)

# Family with children
PassengerInfo(adults=2, children=2, infants_on_lap=1)
PassengerInfo(adults=2, children=2, infants_in_seat=1, infants_on_lap=1)
```

## Support
Expand Down
7 changes: 6 additions & 1 deletion examples/complex_flight_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ def main():
# Create detailed filters
filters = FlightSearchFilters(
trip_type=TripType.ONE_WAY,
passenger_info=PassengerInfo(adults=2, children=1, infants_on_lap=1),
passenger_info=PassengerInfo(
adults=2,
children=1,
infants_in_seat=1,
infants_on_lap=1,
),
flight_segments=[
FlightSegment(
departure_airport=[[Airport.JFK, 0]],
Expand Down
7 changes: 6 additions & 1 deletion examples/complex_round_trip_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ def main():
# Create filters with complex requirements
filters = FlightSearchFilters(
trip_type=TripType.ROUND_TRIP,
passenger_info=PassengerInfo(adults=2, children=1, infants_on_lap=1),
passenger_info=PassengerInfo(
adults=2,
children=1,
infants_in_seat=1,
infants_on_lap=1,
),
flight_segments=[outbound, return_flight],
stops=MaxStops.ONE_STOP_OR_FEWER,
seat_type=SeatType.BUSINESS,
Expand Down
47 changes: 46 additions & 1 deletion fli/cli/commands/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,38 @@ def dates(
help="Trip duration in days",
),
] = 3,
passengers: Annotated[
int,
typer.Option(
"--passengers",
help="Number of adult passengers",
min=1,
),
] = 1,
children: Annotated[
int,
typer.Option(
"--children",
help="Number of children",
min=0,
),
] = 0,
infants_in_seat: Annotated[
int,
typer.Option(
"--infants-in-seat",
help="Number of infants in seat",
min=0,
),
] = 0,
infants_on_lap: Annotated[
int,
typer.Option(
"--infants-on-lap",
help="Number of infants on lap",
min=0,
),
] = 0,
airlines: Annotated[
list[str] | None,
typer.Option(
Expand Down Expand Up @@ -226,6 +258,10 @@ def dates(
"end_date": end_date,
"trip_duration": trip_duration,
"is_round_trip": is_round_trip,
"passengers": passengers,
"children": children,
"infants_in_seat": infants_in_seat,
"infants_on_lap": infants_on_lap,
"cabin_class": seat_type.name,
"max_stops": stops.name,
"departure_window": (
Expand Down Expand Up @@ -260,7 +296,12 @@ def dates(
# Create search filters
filters = DateSearchFilters(
trip_type=trip_type,
passenger_info=PassengerInfo(adults=1),
passenger_info=PassengerInfo(
adults=passengers,
children=children,
infants_in_seat=infants_in_seat,
infants_on_lap=infants_on_lap,
),
flight_segments=segments,
stops=stops,
seat_type=seat_type,
Expand Down Expand Up @@ -320,6 +361,10 @@ def dates(
"end_date": end_date,
"trip_duration": trip_duration,
"is_round_trip": is_round_trip,
"passengers": passengers,
"children": children,
"infants_in_seat": infants_in_seat,
"infants_on_lap": infants_on_lap,
"cabin_class": cabin_class,
"max_stops": max_stops,
"departure_window": (
Expand Down
51 changes: 50 additions & 1 deletion fli/cli/commands/flights.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def _search_flights_core(
departure_date: str,
return_date: str | None = None,
departure_window: str | tuple[int, int] | None = None,
passengers: int = 1,
children: int = 0,
infants_in_seat: int = 0,
infants_on_lap: int = 0,
airlines: list[str] | None = None,
cabin_class: str = "ECONOMY",
max_stops: str = "ANY",
Expand All @@ -50,6 +54,10 @@ def _search_flights_core(
"departure_date": departure_date,
"return_date": return_date,
"departure_window": None,
"passengers": passengers,
"children": children,
"infants_in_seat": infants_in_seat,
"infants_on_lap": infants_on_lap,
"airlines": [airline.upper() for airline in airlines] if airlines else None,
"cabin_class": cabin_class.upper(),
"max_stops": max_stops.upper(),
Expand Down Expand Up @@ -96,7 +104,12 @@ def _search_flights_core(
# Create search filters
filters = FlightSearchFilters(
trip_type=trip_type,
passenger_info=PassengerInfo(adults=1),
passenger_info=PassengerInfo(
adults=passengers,
children=children,
infants_in_seat=infants_in_seat,
infants_on_lap=infants_on_lap,
),
Comment thread
kvasdopil marked this conversation as resolved.
flight_segments=segments,
stops=stops,
seat_type=seat_type,
Expand Down Expand Up @@ -188,6 +201,38 @@ def flights(
help="Departure time window in 24h format (e.g., 6-20)",
),
] = None,
passengers: Annotated[
int,
typer.Option(
"--passengers",
help="Number of adult passengers",
min=1,
),
] = 1,
children: Annotated[
int,
typer.Option(
"--children",
help="Number of children",
min=0,
),
] = 0,
infants_in_seat: Annotated[
int,
typer.Option(
"--infants-in-seat",
help="Number of infants in seat",
min=0,
),
] = 0,
infants_on_lap: Annotated[
int,
typer.Option(
"--infants-on-lap",
help="Number of infants on lap",
min=0,
),
] = 0,
airlines: Annotated[
list[str] | None,
typer.Option(
Expand Down Expand Up @@ -251,6 +296,10 @@ def flights(
departure_date=departure_date,
return_date=return_date,
departure_window=departure_window,
passengers=passengers,
children=children,
infants_in_seat=infants_in_seat,
infants_on_lap=infants_on_lap,
airlines=airlines,
cabin_class=cabin_class,
max_stops=max_stops,
Expand Down
50 changes: 48 additions & 2 deletions fli/mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ class FlightSearchParams(BaseModel):
ge=1,
description="Number of adult passengers",
)
children: int = Field(0, ge=0, description="Number of children")
infants_in_seat: int = Field(0, ge=0, description="Number of infants in seat")
infants_on_lap: int = Field(0, ge=0, description="Number of infants on lap")
exclude_basic_economy: bool = Field(
False, description="Exclude basic economy fares from results"
)
Expand Down Expand Up @@ -275,6 +278,9 @@ class DateSearchParams(BaseModel):
ge=1,
description="Number of adult passengers",
)
children: int = Field(0, ge=0, description="Number of children")
infants_in_seat: int = Field(0, ge=0, description="Number of infants in seat")
infants_on_lap: int = Field(0, ge=0, description="Number of infants on lap")


# =============================================================================
Expand Down Expand Up @@ -359,7 +365,12 @@ def _execute_flight_search(params: FlightSearchParams) -> dict[str, Any]:
# Create search filters
filters = FlightSearchFilters(
trip_type=trip_type,
passenger_info=PassengerInfo(adults=params.passengers),
passenger_info=PassengerInfo(
adults=params.passengers,
children=params.children,
infants_in_seat=params.infants_in_seat,
infants_on_lap=params.infants_on_lap,
),
flight_segments=segments,
stops=max_stops,
seat_type=cabin_class,
Expand Down Expand Up @@ -425,7 +436,12 @@ def _execute_date_search(params: DateSearchParams) -> dict[str, Any]:
# Create search filters
filters = DateSearchFilters(
trip_type=trip_type,
passenger_info=PassengerInfo(adults=params.passengers),
passenger_info=PassengerInfo(
adults=params.passengers,
children=params.children,
infants_in_seat=params.infants_in_seat,
infants_on_lap=params.infants_on_lap,
),
flight_segments=segments,
stops=max_stops,
seat_type=cabin_class,
Expand Down Expand Up @@ -516,6 +532,18 @@ def search_flights(
int | None,
Field(description="Number of adult passengers", ge=1),
] = None,
children: Annotated[
int,
Field(description="Number of children", ge=0),
] = 0,
infants_in_seat: Annotated[
int,
Field(description="Number of infants in seat", ge=0),
] = 0,
infants_on_lap: Annotated[
int,
Field(description="Number of infants on lap", ge=0),
] = 0,
exclude_basic_economy: Annotated[
bool,
Field(description="Exclude basic economy fares from results"),
Expand All @@ -538,6 +566,9 @@ def search_flights(
max_stops=max_stops,
sort_by=sort_by,
passengers=passengers or CONFIG.default_passengers,
children=children,
infants_in_seat=infants_in_seat,
infants_on_lap=infants_on_lap,
exclude_basic_economy=exclude_basic_economy,
)
return _execute_flight_search(params)
Expand Down Expand Up @@ -595,6 +626,18 @@ def search_dates(
int | None,
Field(description="Number of adult passengers", ge=1),
] = None,
children: Annotated[
int,
Field(description="Number of children", ge=0),
] = 0,
infants_in_seat: Annotated[
int,
Field(description="Number of infants in seat", ge=0),
] = 0,
infants_on_lap: Annotated[
int,
Field(description="Number of infants on lap", ge=0),
] = 0,
) -> dict[str, Any]:
"""Find the cheapest travel dates between two airports within a date range.

Expand All @@ -615,6 +658,9 @@ def search_dates(
departure_window=effective_departure_window,
sort_by_price=sort_by_price,
passengers=passengers or CONFIG.default_passengers,
children=children,
infants_in_seat=infants_in_seat,
infants_on_lap=infants_on_lap,
)
return _execute_date_search(params)

Expand Down
Loading
Loading