Skip to main content
Glama

Pay and book a flight

brij_book_flight

Over MCP: you pay only the purchase itself, into its escrow. Pays the ticket into the intent's escrow with x402 (USDC on Solana). Call it once without payment to get the payment requirements, sign them with your wallet, and call again with the payment in _meta["x402/payment"] or in x402_payment (the base64 PAYMENT-SIGNATURE value).

Pay the escrow and request booking.

The intent id travels in the request body; the resource URL is static. Paid x402 endpoint. The payment challenge is dynamic for the intent: payTo is the intent escrow address, asset is the expected escrow mint, and amount is the expected escrow amount.

After x402 settlement, the API records the passenger list (lead first), verifies exact escrow funding on-chain, and enqueues the booking worker. Airline payment and escrow capture happen asynchronously.

If booking fails after x402 settlement, retry the same /book call; excess funds remain refundable to refund_wallet.

Booking is asynchronous: poll GET /air/intents/{intent_id} until booked or refunded.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "intent_id": "<intent_id>",
      "passengers": "<passengers>"
    },
    "name": "brij_book_flight"
  }
}

Input Schema

NameRequiredDescriptionDefault
intent_idYesId returned by POST /air/intents.
passengersYesExactly as many passengers as the intent's passenger_count (= adults searched), LEAD PASSENGER FIRST. Positions map to the offer's travellers. The lead passenger receives all emails, and refund requests authenticate against the LEAD passenger's family name. Duplicate travellers (same name and birth date) are refused with 400 duplicate_passenger. All refunds are all-or-nothing: one booking = one escrow, there is no per-passenger cancellation.
x402_paymentNoOptional: the base64 x402 payment payload (the PAYMENT-SIGNATURE header value), for a client that cannot set _meta["x402/payment"].

Output Schema

NameRequiredDescriptionDefault
intentNo
bookingNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / passengers / items / properties / nationality / description
      Previous value: -"REQUIRED for trip.com: offers, ignored otherwise. Passenger nationality as a country name in English, e.g. \"France\" — the supplier's booking form demands the travel document up front."New value: +"Only when a supplier asks for it; ignored otherwise. Passenger nationality as a country name in English, e.g. \"France\" — the supplier's booking form demands the travel document up front."
    • changedInput schema / properties / passengers / items / properties / passport_expiry / description
      Previous value: -"REQUIRED for trip.com: offers, ignored otherwise. Document expiry, YYYY-MM-DD, must be in the future. Missing/expired documents are refused BEFORE payment (400 travel_document_required / travel_document_expired)."New value: +"Only when a supplier asks for it; ignored otherwise. Document expiry, YYYY-MM-DD, must be in the future. Missing/expired documents are refused BEFORE payment (400 travel_document_required / travel_document_expired)."
    • changedInput schema / properties / passengers / items / properties / passport_number / description
      Previous value: -"REQUIRED for trip.com: offers, ignored otherwise. Passport or national ID number."New value: +"Only when a supplier asks for it; ignored otherwise. Passport or national ID number."
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

With annotations only covering readOnly/openWorld/idempotent/destructive flags, the description carries real behavioral weight: funds go into the intent's escrow rather than to the airline directly, the challenge values (payTo/asset/amount) derive from the intent, settlement triggers on-chain escrow verification and an async booking worker, airline payment and capture happen later, and excess funds stay refundable to refund_wallet. It also discloses failure semantics (escrow funded but booking failed → retry; validation errors are rejected before settlement so no funds move).

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

Conciseness3/5

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

The core flow is front-loaded, but the prose repeats itself ('you pay only the purchase itself, into its escrow' then 'Pays the ticket into the intent's escrow', then 'Pay the escrow and request booking') and contains an awkward stub sentence followed by a separate paragraph. Line breaks fragment related claims about settlement instead of grouping them, costing scanability.

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?

For a payment-bearing mutation with a complex two-phase protocol, the description covers funding source, pre-settlement validation, asynchronous processing, retry path, and refund destination; return-value detail is not needed because an output schema exists. Nothing an agent must know to avoid double-paying or mis-calling is missing.

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 meaning the schema does not: intent_id travels in the body while the resource URL is static, and the payment challenge is dynamic per intent. That context is what lets an agent construct the paid second call correctly, though per-field semantics of passengers are left entirely to the schema.

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 description states a concrete verb+resource pair ('Pay the escrow and request booking'), and makes clear this is the x402 settlement step that consumes an intent_id produced elsewhere ('Id returned by POST /air/intents'). An agent can distinguish this from intent creation and from order polling without opening any schema.

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

Usage Guidelines4/5

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

It gives an explicit call sequence: call once without payment to obtain the challenge, sign it, then call again with the payment in _meta or x402_payment. It also prescribes retry ('retry the same /book call') and post-success polling ('poll GET /air/intents/{intent_id} until booked or refunded'). It never names a sibling tool as the alternative for the pre-step or the polling step, so it stops just short of full when/when-not routing.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources