Skip to main content
Glama

PayStage — x402 payment safety and spend policy

decode_payment_required

Read-only

verify the recipient. Call this first when a 402 response arrives and you cannot read the payment-required header. Returns the decoded x402 v2 challenge: scheme, network, asset, atomic amount, payee, resource and timeout. Pure decoding: no network call, no signature, no verdict — use evaluate_mcp_payment when you want a decision. Fails closed with a named error if the header is malformed or not base64.

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": {
      "header": "<header>"
    },
    "name": "decode_payment_required"
  }
}

Input Schema

NameRequiredDescriptionDefault
headerYesThe raw base64 value of the payment-required header

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

The annotations already declare readOnlyHint=true, destructiveHint=false and openWorldHint=false, yet the description still adds meaningful behavior: pure local decoding with no network call, no signature and no verdict, plus fail-closed behavior with a named error on a malformed or non-base64 header. The only gap is that it does not describe the shape of the error or the exact field types, which slightly limits it below a 5.

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?

The trigger condition and scope are front-loaded, followed by the returned fields, the contrast with the sibling tool, and the failure mode. Every sentence carries information an agent needs, with no repetition of the schema or annotations.

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

Completeness4/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 usefully enumerates the decoded return fields and states the error behavior, and it clarifies that no network call occurs. It is nearly complete for a one-parameter decoding tool, though it could specify the exact error name or the units of the atomic amount.

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?

There is a single required parameter with 100% schema description coverage, so the schema already explains that it is the raw base64 value of the payment-required header. The description reinforces the context (a header the agent cannot read) but adds no format, length or encoding detail beyond what the schema provides, making the baseline of 3 appropriate.

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 names a specific verb and resource ('decode... the payment-required header') and enumerates the exact decoded fields returned: scheme, network, asset, atomic amount, payee, resource and timeout. It explicitly distinguishes itself from evaluate_mcp_payment, so an agent can select it without inspecting either schema.

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?

It states the trigger condition precisely ('Call this first when a 402 response arrives and you cannot read the payment-required header') and names the alternative plus the condition that selects it ('use evaluate_mcp_payment when you want a decision'). When-to-use, when-not-to-use and the alternative are all explicit.

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.