Skip to main content
Glama

x402 Payment Request Parser

Parse an x402 payment request

x402_parse_payment_request
Read-onlyIdempotent

Free. Decode one x402 v2 payment request (base64 PAYMENT-REQUIRED header, PaymentRequired JSON or MCP tool result) and list every accepts option with exact atomic and decimal amounts. Token addresses are compared with a limited reference list. status: parsed, ambiguous (options differ in recipient, network or amount; none is chosen), malformed or unsupported. Does not verify the merchant, authorize a transfer, assess fraud risk, or guarantee any payment. URLs in the input are never fetched.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rawYesThe payment request. A string: the base64 PAYMENT-REQUIRED header value (a leading 'PAYMENT-REQUIRED:' is allowed) or JSON text. An object: the PaymentRequired JSON, or for transport mcp the tool result (structuredContent, _meta x402/error or content[0].text).
transportNoWhere the request came from: http (402 response) or mcp (paid tool result). Default http.http

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYes
noteYes
termsYesURL of the terms of service.
errorsYes
parsedYesThe decoded request with every accepts option (null unless status is parsed or ambiguous).
statusYesparsed = the checked x402 v2 structure had no defects (not a statement about the merchant or whether to pay). ambiguous = options differ in recipient, network or amount; none was chosen. malformed / unsupported = could not be fully read.
evidenceYes
warningsYes
mismatchesYes
provenanceYesVersion and sources of the bundled asset table.
comparisonsYes
unsupportedYes
decoded_fromYes
checked_scopeYes
payment_required_locationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-openWorld, but the description adds substantive behavior: the four possible outcomes (parsed, ambiguous, malformed, unsupported), how ambiguity is resolved (options differ in recipient, network or amount and none is chosen), the limited token reference list, and the no-fetch guarantee. These prevent an agent from treating a parse as verification or expecting a network resolution.

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

Conciseness5/5

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

Five dense sentences, front-loaded with the cost signal and the core action, then outputs, then limits. Every clause carries information (formats, statuses, guardrails) and nothing is padding.

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 an output schema present, the description need not enumerate return fields, and it still supplies the status vocabulary and the ambiguity rule. Combined with complete parameter coverage and full annotations, an agent has everything needed to call and interpret this tool correctly.

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%, so both parameters already carry full definitions including the string/object union and the transport enum. The description largely restates those input forms and adds only the note about the limited token reference list, so the baseline 3 applies.

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 (decode) and resource (one x402 v2 payment request), enumerates the accepted input encodings, and says exactly what the output is: every accepts option with atomic and decimal amounts. The scope line ('Does not verify the merchant, authorize a transfer...') draws the boundary against neighbors like get_receipt and x402_known_assets without ambiguity.

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?

The 'Free.' prefix and the explicit negative list (does not verify merchant, authorize transfer, assess fraud, guarantee payment; URLs never fetched) tell the agent when this tool is the wrong choice. However, it never names an alternative sibling or states a positive trigger condition (e.g. 'use before signing a 402 response'), so routing is only implicit.

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