Skip to main content
Glama
Replaced by its MCP Registry listing

This endpoint is listed in the official MCP Registry as BlazePhoenix on-chain DEX aggregator. If you published it, claim ownership there.

Decode a USD value

decode_usd_value
Read-onlyIdempotent

Decode the eth_call result YOUR node returned for a USD value (usd.in of prepare_quote with usd:true, or usdOut of decode_quote): the amount in USD (via USDC; USDG on Robinhood Chain; the dollar token counts as 1 USD), measured as Quoter netOut after the 0.28% fee, including price impact. Each via (direct, via WETH, via the tokens the direct route crosses; at most 8) is listed; the value is the minimum over measured vias, with the spread when two or more are measured. A via that reverts, finds no route or nets 0 is "not measured"; with none measured the value is "not measured", never 0. When the route crosses other tokens, the answer is next: a second eth_call pinned at the block hash of the first (EIP-1898, requireCanonical); run it and decode that one. That needs blockHash, the hash of the block the first call ran at (read the header with eth_getBlockByNumber and pin the call there, or pass blockHash to prepare_quote, which pins usd.in only). usdOut of decode_quote is prepared at latest: replace latest with {blockHash, requireCanonical: true} of a header you read, run it, and pass that hash here as blockHash. Without a hash the value is "not measured", never a call pinned by number. If your node answers an error for the hash, start again. Pure computation.

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": {
      "request": "<request>",
      "result": "<result>"
    },
    "name": "decode_usd_value"
  }
}

Input Schema

NameRequiredDescriptionDefault
resultYesthe 0x hex result of that eth_call on your node
requestYesthe `request` object of the USD call (usd.in, usdOut or next), verbatim
blockHashNothe hash of the block the first USD call ran at (optional; needed when the route crosses other tokens)

Output Schema

NameRequiredDescriptionDefault
okYesfalse: see code, error
rpcNo
usdNo
codeNo
modeNo
nextNo
viasNo
basisNo
errorNo
labelNo
tokenNo
reasonNo
spreadNo
chainIdNo
versionNo
amountInNo
completeNo
usdValueNo
unitPriceNo
blockNumberNo
dollarTokenNo
tokenDecimalsNo
dollarDecimalsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/closed-world, and the description adds substantial behavior beyond them: vias are measured as Quoter netOut after the 0.28% fee with price impact, the result is the minimum over measured vias with a spread, unmeasured vias never yield 0, and a second EIP-1898-pinned eth_call is required. It does not spell out the decoded output shape, but an output schema exists, so this is close to full transparency without contradicting any annotation.

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?

Content is front-loaded and every major point is relevant, but the prose is dense and tangled with nested parentheticals (USDC/USDG aside, "direct, via WETH, via the tokens the direct route crosses; at most 8") and repeats the "not measured, never 0" rule twice. It could be restructured into discrete steps without losing information.

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 tool whose complexity lies in a two-stage eth_call protocol with a block-pinning requirement, the description supplies the full flow, the edge cases (revert, no route, net 0), and the recovery path, while the output schema handles return-shape explanation.

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 baseline is 3, but the description adds real meaning: `result` is the 0x hex of that specific eth_call, `request` must be passed verbatim, and `blockHash` must be the header hash of the block the first call ran at with `{blockHash, requireCanonical: true}` – plus the consequence that omitting it yields "not measured" rather than a call pinned by number.

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?

Opens with a specific verb+resource ("Decode the eth_call result ... for a USD value") and pins exactly which inputs it consumes – `usd.in` from prepare_quote with usd:true, or `usdOut` from decode_quote – so an agent can separate it from decode_quote at a glance.

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?

States the triggering condition (after prepare_quote/decode_quote), the conditional branch when the route crosses other tokens, and the concrete next action (run the `next` call, optionally call prepare_quote with blockHash). It even covers the failure path – "If your node answers an error for the hash, start again" – leaving little to inference.

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