Skip to main content
Glama

Monto de token ↔ unidades base

token-units-convert
Read-onlyIdempotent

Convierte montos de tokens entre decimal y unidades base enteras de forma exacta (USDC 6 decimales, ETH 18…), como en x402. Cuándo: un flujo de agente necesita un resultado exacto y repetible para un paso auxiliar (tokens, costos, reintentos, fragmentos, ranking, limpieza de JSON). No para: estimar el costo de llamadas a un LLM a partir de tokens (llm-cost-estimate). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.

EN: Converts a token amount between decimal and integer base units exactly (BigInt), e.g. USDC (6 decimals) 1.5 ↔ 1500000, ETH (18) or any decimals 0-36, as used in x402 payment requirements. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). [EN completo / full EN: inputSchema.description]

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "amount": "0.001"
    },
    "name": "token-units-convert"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountNoDecimal amount (to base units) (string; optional; up to 80 chars).
decimalsNoToken decimals (USDC = 6) (integer; optional; default 6; min 0; max 36).
base_unitsNoInteger base units (to decimal) (string; optional; pattern ^\d{1,80}$).

Output Schema

NameRequiredDescriptionDefault
amountNo
decimalsNo
base_unitsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "amount": "0.001"
      +  }
      +]
  2. Changed1 schema field changed
    • addedInput schema / description
      Added value: +"EN: Converts a token amount between decimal and integer base units exactly (BigInt), e.g. USDC (6 decimals) 1.5 ↔ 1500000, ETH (18) or any decimals 0-36, as used in x402 payment requirements. When: an agent loop needs an exact, repeatable result for a bookkeeping step (tokens, costs, retries, chunking, ranking, JSON clean-up). Not for: estimating LLM request cost from input/output token counts (llm-cost-estimate). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB."
  3. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, openWorldHint=false and idempotentHint, so the restatement of 'read-only / deterministic' earns little credit. The description does add genuinely new behavioral context: exactness via BigInt, no network, no stored state, and hard limits of 64 KB input, 1 s per call and 1 MB result.

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?

The core sentence is front-loaded and the 'When/Not for/Side effects/Limits' structure is scannable, but the content is duplicated three times (Spanish block, English block, and again in inputSchema.description). That redundancy bloats the definition without adding 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 pure computation tool with rich annotations, a full schema and an output schema, the description covers everything an agent needs: direction of conversion, precision semantics, determinism, side-effect profile, and resource limits. No return-value explanation is required because an output schema exists.

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 amount/decimals/base_units are already documented in the schema itself. The description reinforces the decimal range (0-36) and gives worked examples, but does not clarify the key ambiguity of whether amount and base_units are alternative directions or can be supplied together, so it stays at the baseline.

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+resource (converting token amounts between decimal and integer base units) and anchors it with concrete examples (USDC 6 decimals 1.5 ↔ 1500000, ETH 18, decimals 0-36). It explicitly distinguishes the tool from llm-cost-estimate and ties it to the x402 use case, so an agent can identify it without opening the 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?

Uses explicit 'Cuándo/Cuándo no' and 'When/Not for' framing: use it for exact, repeatable bookkeeping steps; do not use it to estimate LLM call cost, and it names llm-cost-estimate as the alternative. That is a direct when/when-not/alternative mapping.

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