Skip to main content
Glama

searchFlightsMatrix

Search flight fares across nearby departure and return dates within a flexible window to compare one-way or round-trip date combinations.

Instructions

Overview

Search the cheapest fare for each departure (and, on round-trips, return) date combination across a grid of nearby dates — ±flexDays around the dates in your request. Accepts the same legs-based body as POST /flights/rates plus optional flexDays (1–3, default 3).

Supported: one-way (1 leg) or round-trip (2 legs) only. Multi-city (3+ legs) is not supported.

Not supported: top-level origin, destination, departureDate, or returnDate — use legs only.

Access

Requires Flights API access and matrix enablement on your account. Matrix search is not enabled by default — contact the LiteAPI support team to request access.

When to Use

  • Flexible-date calendars — price heatmap when the traveller can shift dates

  • Cheap-date discovery — find the lowest fare in a ±N day window before a full /flights/rates search

  • Round-trip date pairing — compare outbound × return combinations on one grid

  • Progressive UI — stream cells over SSE as each underlying search completes

What You Get

  • cells — one entry per valid date combination, sorted by (outboundOffset, returnOffset)

  • cheapest — globally lowest-priced cell (null when nothing was priced)

  • currency — currency of the global cheapest cell

  • baseOutboundDate / baseReturnDate — the originally requested dates

  • flexDays, roundTrip — grid metadata

  • Per-cell price, currency, date offsets, and whether the underlying search was cached or success

  • Margined prices — cell price, cheapest, and currency include the authenticated user's rate-search margin (same as /flights/rates)

Key Features

  • Probes ±flexDays (1–3) around requested departure and return dates

  • Each underlying date pair uses normal provider caching — a later POST /flights/rates for a matrix date is served from warm cache

  • SSE: send header Accept: text/event-stream for incremental events: matrix-start (grid skeleton), matrix-chunk (one priced cell), matrix-complete (full sorted grid + cheapest)

  • Same global filters, sort, and options as /flights/rates where applicable

Quick Start

Required: legs (1 leg for one-way or 2 for round-trip, each with origin, destination, date), adults (≥ 1), currency

Optional: flexDays (1–3, default 3), country, passenger counts, filters, sort

Round-trip: two legs — outbound then return with optional direction OUTBOUND / INBOUND. One-way: one leg.

After choosing a date pair from the matrix, call POST /flights/rates with legs set to those dates for full offer details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
legsYesOne leg (one-way) or two legs (round-trip). Multi-city is not supported.
adultsYesNumber of adult passengers (≥ 1).
countryNoISO country code for point of sale
infantsNoNumber of infant passengers (under 2).
childrenNoNumber of child passengers (ages 2-11).
currencyYesISO 4217 currency for point of sale and displayed prices.
flexDaysNoDays before/after requested dates to probe

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Despite annotations being present, the description adds substantial behavioral context they cannot convey: matrix access is not enabled by default and requires contacting LiteAPI support, underlying searches are provider-cached so a later /flights/rates call is served from warm cache, returned prices include the user's margin, and SSE streaming events are enumerated. This is exactly the kind of extra disclosure the annotations cannot carry.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is lengthy, but the markdown structure is clean and front-loaded: Overview, Access, When to Use, What You Get, Quick Start. Some content repeats between 'Key Features' and 'Overview' (flexDays probing, caching), which costs a point, but every section is navigable and earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description fully carries the return-value burden: it enumerates cells, cheapest, currency, baseOutboundDate/baseReturnDate, flexDays, roundTrip, and per-cell price/currency/offsets/cached status. Access prerequisites and SSE behavior are also covered, leaving nothing an agent needs to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real value beyond the schema: flexDays is documented as 1–3 with a default of 3 (the schema omits the default), legs must be exactly one or two with outbound/return ordering, and required vs optional fields are restated coherently.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The overview states a specific verb and resource: 'Search the cheapest fare for each departure... date combination across a grid of nearby dates.' It precisely scopes the operation (±flexDays around requested dates) and distinguishes itself from the related /flights/rates endpoint, which it names explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

A dedicated 'When to Use' section lists four concrete scenarios (flexible-date calendars, cheap-date discovery, round-trip pairing, progressive UI), plus explicit 'Supported' (1–2 legs) and 'Not supported' (multi-city, top-level date/origin fields) boundaries. It also tells the agent what to call next — POST /flights/rates for full offer details.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools