Skip to main content
Glama

x402_convert_atomic_units

Read-onlyIdempotent

Converts exact decimal amounts to integer minor/atomic units and back, rejecting fractional sub-atomic dust instead of rounding it.

Instructions

Exact Decimal string <-> integer minor/atomic unit converter (USD 2, EUR 2, VND 0, JPY 0, KWD 3, USDC 6, sBTC 8, SOL 9, WEI 18) with explicit SUB_ATOMIC_DUST_REJECTED rounding rejection whenever fractional sub-atomic dust is supplied.

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": {
      "amount": "<amount>",
      "currency": "<currency>"
    },
    "name": "x402_convert_atomic_units"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountYesExact decimal string (e.g. `'1.25'`, `'0.0005'`) or exact integer atomic value (floats rejected).
currencyYesCurrency or token code (`USD`, `EUR`, `VND`, `JPY`, `KWD`, `USDC`, `sBTC`, `SOL`, `WEI`).
directionNo`to_atomic` converts human decimal string -> integer minor units; `from_atomic` converts integer -> decimal string.to_atomic
allow_negativeNoAllow negative values (default `False` for payment amounts).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the safety profile is covered; the description instead adds the behavior an agent actually needs: sub-atomic dust is rejected with a named error code `SUB_ATOMIC_DUST_REJECTED`, and floats are rejected. It stops short of describing the return shape or what the error looks like on the wire, which keeps it from 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.

Conciseness4/5

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

One front-loaded sentence: purpose first, then the currency/exponent table, then the failure mode. Dense backticked notation is efficient rather than wasteful, though the parenthetical table makes it slightly hard to scan.

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 4-parameter, no-output-schema conversion utility, the definition covers inputs, supported currencies, precision, sign handling and the dust-rejection failure mode. The only gap is the return value's exact type per direction, which the agent must infer from the `direction` enum.

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 genuinely extends `currency`: the schema lists the codes without their decimal places, while the description supplies the exponent for each (`KWD` 3, `USDC` 6, `WEI` 18). That per-currency precision is exactly the information an agent needs to pass `amount` correctly.

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 precise verb and resource: exact Decimal string <-> integer minor/atomic unit conversion, and enumerates the supported currencies with their exponents. Nothing in the sibling list (policy enforcement, header inspection, settlement webhooks) overlaps with this, so an agent can route to it unambiguously.

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?

Usage is only implied: the currency/exponent table and the 'payment amounts' phrasing in `allow_negative` signal that this is a pre-payment normalization step. There is no explicit when-to-use, when-not-to-use, or named alternative (e.g. when to use `to_atomic` vs `from_atomic` is left to the schema).

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