Skip to main content
Glama

Preflight a payment (allow / hold / block)

preflight_payment
Read-only

Call this before any x402/USDC payment to evaluate the actual challenge or cart before signing. Spend preflight for AI agents. Send the x402 PaymentRequired body (v1 or v2) you received, or a cart, plus optional rules (per-payment max, hold threshold, daily cap, allowlists, new-domain days, endpoint category price multiple, liveness and payTo changes). Returns allow|hold|block with reasons, the cheapest acceptable payment option, and a receipt id. Read-only: never signs, settles, or holds funds. Use before every payment. It includes payee screening in its spending-rule decision. For standalone wallet, name, or domain screening without a payment, use check_payee instead. Each repeat call creates a new receipt and may consume another trial or paid call. Price $0.02 per call (free trial first).

Input Schema

NameRequiredDescriptionDefault
cartNoUse instead of challenge for agent checkout / card payments
rulesNoSpending rules; all optional. See get_service_info for defaults.
challengeNoThe x402 PaymentRequired body (v1 or v2) your agent received with HTTP 402
resource_urlNoURL that returned the 402, if not inside the challenge
resource_methodNoAdvertised method for an indexed URL with multiple methods
spent_today_usdNoWhat this agent already spent today, for the daily cap

Output Schema

NameRequiredDescriptionDefault
payeeNoPayee screening details
reasonsYesEvery rule that fired, prefixed with its decision
receiptYesSigned decision; keep privately for audit
decisionYesPay on allow, ask a human on hold, never pay on block
chosen_optionNoThe cheapest acceptable payment option
index_evidenceYes
options_evaluatedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"Example arguments: {\"cart\":{\"merchant_name\":\"Example Shop LLC\",\"total_usd\":0.01},\"rules\":{\"max_per_payment_usd\":1},\"spent_today_usd\":0}"
  2. Changed29 schema fields changed
    • addedInput schema / properties / resource_method
      Added value: +{
      +  "description": "Advertised method for an indexed URL with multiple methods",
      +  "maxLength": 16,
      +  "minLength": 3,
      +  "type": "string"
      +}
    • addedInput schema / properties / rules / properties / allowed_networks / items / maxLength
      Added value: +128
    • addedInput schema / properties / rules / properties / allowed_networks / items / minLength
      Added value: +1
    • addedInput schema / properties / rules / properties / allowed_networks / maxItems
      Added value: +100
    • addedInput schema / properties / rules / properties / daily_cap_usd / minimum
      Added value: +0
    • addedInput schema / properties / rules / properties / domain_allowlist / items / maxLength
      Added value: +253
    • addedInput schema / properties / rules / properties / domain_allowlist / items / minLength
      Added value: +1
    • addedInput schema / properties / rules / properties / domain_allowlist / maxItems
      Added value: +100
    • addedInput schema / properties / rules / properties / domain_blocklist / items / maxLength
      Added value: +253
    • addedInput schema / properties / rules / properties / domain_blocklist / items / minLength
      Added value: +1
    • addedInput schema / properties / rules / properties / domain_blocklist / maxItems
      Added value: +100
    • addedInput schema / properties / rules / properties / hold_above_usd / minimum
      Added value: +0
    • addedInput schema / properties / rules / properties / hold_on_payto_change
      Added value: +{
      +  "type": "boolean"
      +}
    • addedInput schema / properties / rules / properties / max_per_payment_usd / exclusiveMinimum
      Added value: +0
    • addedInput schema / properties / rules / properties / max_price_multiple
      Added value: +{
      +  "anyOf": [
      +    {
      +      "exclusiveMinimum": 0,
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedInput schema / properties / rules / properties / new_domain_days / minimum
      Added value: +0
    • addedInput schema / properties / rules / properties / payto_allowlist / items / maxLength
      Added value: +128
    • addedInput schema / properties / rules / properties / payto_allowlist / items / minLength
      Added value: +1
    • addedInput schema / properties / rules / properties / payto_allowlist / maxItems
      Added value: +100
    • addedInput schema / properties / rules / properties / payto_blocklist / items / maxLength
      Added value: +128
    • addedInput schema / properties / rules / properties / payto_blocklist / items / minLength
      Added value: +1
    • addedInput schema / properties / rules / properties / payto_blocklist / maxItems
      Added value: +100
    • addedInput schema / properties / rules / properties / require_live
      Added value: +{
      +  "type": "boolean"
      +}
    • addedInput schema / properties / rules / properties / screen_sanctions
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / index_evidence
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "data_as_of": {
      +      "type": "string"
      +    },
      +    "note": {
      +      "type": "string"
      +    },
      +    "observed_at": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "status": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "note"
      +  ],
      +  "type": "object"
      +}
    • changedOutput schema / properties / receipt / description
      Previous value: -"Log this for audit"New value: +"Signed decision; keep privately for audit"
    • addedOutput schema / properties / receipt / properties / jws
      Added value: +{
      +  "description": "Offline-verifiable EdDSA decision attestation",
      +  "type": "string"
      +}
    • changedOutput schema / properties / receipt / required
      Previous value: -[
      -  "id",
      -  "ts",
      -  "input_sha256",
      -  "decision"
      -]New value: +[
      +  "id",
      +  "ts",
      +  "input_sha256",
      +  "decision",
      +  "jws"
      +]
    • changedOutput schema / required
      Previous value: -[
      -  "decision",
      -  "reasons",
      -  "options_evaluated",
      -  "receipt"
      -]New value: +[
      +  "decision",
      +  "reasons",
      +  "options_evaluated",
      +  "index_evidence",
      +  "receipt"
      +]
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint by disclosing cost ($0.02/call, free trial), non-idempotency consequence (each repeat call creates a new receipt and may consume trial or paid calls), the fact it never signs/settles/holds funds, and that it embeds payee screening. These are non-obvious traits annotations cannot express.

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?

Front-loads purpose and usage, then adds pricing and the sibling alternative. Fairly dense but every clause carries information; slightly list-heavy on rule names, though not wasteful.

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?

Despite an output schema existing, the description still conveys the return decision set (allow|hold|block, reasons, cheapest option, receipt id), cost model, and read-only guarantee. It provides everything an agent needs to decide to call it and what to expect.

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

Parameters3/5

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

Schema description coverage is 100% and the nested rules object is fully typed, so the schema already documents parameters. The description enumerates rule categories (per-payment max, hold threshold, daily cap, allowlists, new-domain days, price multiple, liveness, payTo changes) and the challenge/cart distinction, adding modest mapping value but no syntax beyond 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?

States a specific verb (preflight/evaluate) and resource (x402/USDC payment challenge or cart) and frames its decision output as allow|hold|block. It explicitly distinguishes itself from the sibling check_payee by scoping to payments with embedded payee screening.

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?

Explicit when-to-use ('Call this before any x402/USDC payment', 'Use before every payment') and when-not ('For standalone wallet, name, or domain screening without a payment, use check_payee instead'). Both the trigger and the alternative are named.

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