Skip to main content
Glama

decode_402

Read-onlyIdempotent

Parse and validate an x402 PaymentRequired (HTTP 402) response, explain each field, and flag missing scheme, network, asset, payTo, amount, or decimals to fix invalid payment requirements.

Instructions

Parse and validate an x402 PaymentRequired (HTTP 402) response and explain every field. Flags missing economic fields (scheme/network/asset/payTo/amount), number-typed or human-decimal amounts (must be atomic-integer strings), and missing explicit decimals. Provide ONE of: url (does an unpaid GET and decodes the 402), raw (a JSON or base64-encoded-JSON body string), or json (an object). Deterministic; the only network is the optional unpaid GET.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "decode_402"
  }
}

Input Schema

NameRequiredDescriptionDefault
rawNoA PaymentRequired as a JSON string or base64-encoded JSON.
urlNoResource URL to GET unpaid; expects a 402 with a PaymentRequired body.
jsonNoA PaymentRequired as an object.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

The annotations already declare read-only, open-world, idempotent, and non-destructive behavior. The description adds useful behavioral detail beyond that: it is deterministic, the only network action is an optional unpaid GET, and it explicitly lists validation checks such as missing economic fields and invalid amount formats. It still does not describe output shape or error behavior when zero or multiple input modes are supplied.

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 description front-loads the purpose, then specifies validation behavior, input modes, and network constraints in compact sentences. Every sentence contributes useful information, and there is no redundant restatement of the title 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?

For a three-parameter, read-only decoding tool with no output schema, the description covers purpose, validation checks, input exclusivity, and network side effects. The main remaining gap is that it does not say what happens if no input or multiple inputs are provided, nor does it describe the returned explanation or error format.

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 description coverage is 100%, so the schema already defines each parameter. The description adds important semantics beyond the schema by requiring exactly one of url, raw, or json and by clarifying that url performs an unpaid GET to retrieve the 402 response. This helps an agent avoid supplying multiple input modes.

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

Purpose4/5

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

The description states specific verbs (parse and validate) and a specific resource (x402 PaymentRequired HTTP 402 response), and it explains what kinds of fields and issues it handles. It does not explicitly differentiate itself from siblings such as inspect_payment_response or check_compliance, so it falls short of a 5.

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

Usage Guidelines3/5

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

The description gives clear context that the tool is for decoding 402 PaymentRequired responses and says to provide exactly one of url, raw, or json. It does not state when to use this tool versus sibling validation or inspection tools, so the usage guidance is implied rather than explicit.

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