Skip to main content
Glama

Ankr Agent RPC

Token price

getTokenPrice
Read-only

USD price of a token on one blockchain: pass a contract address for an ERC-20, or leave it empty for the native coin. Returns { chain, asset, usd, priced_via_contract, as_of: { timestamp, blockNumber, lag, status } }. Read as_of before reporting a price; it says how stale the indexer's view is. A native-coin query is priced from the WRAPPED token, which is why priced_via_contract is a wrapped-token address rather than the coin itself.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoChain slug, e.g. eth, bsc, polygon.
blockchainNoDEPRECATED alias for `chain`. Use `chain`.
contractAddressNoContract address of the token. Leave empty for native coin.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint, so the description carries the real behavioral burden and does so well: it discloses the staleness/lag semantics of as_of, and the non-obvious fact that native-coin queries are priced through the wrapped token, which explains a field value that would otherwise look wrong.

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?

Front-loaded with the core purpose, then the mode selection rule, then the return shape, then the one genuinely surprising semantic detail. No filler sentences; each one carries unique information.

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 inlines the response shape and the meaning of as_of, which is what an agent needs before reporting a number. It does not cover failure/unpriced-token behavior or how fresh a price is expected to be for a typical chain.

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 the parameter meanings are already documented. The description still adds value by explaining why contractAddress is left empty and what happens internally in that case. It does not mention the deprecated `blockchain` alias that the schema flags.

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 resource (USD price of a token) with an explicit scope constraint (on one blockchain), which cleanly separates it from getTokenPriceHistory and getBalances. An agent knows exactly what it gets back: one spot price, not a series or a portfolio.

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

Usage Guidelines4/5

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

Gives concrete conditional usage: pass a contract address for an ERC-20, omit it for the native coin. It also directs the agent to read as_of before reporting a price. It stops short of naming alternatives (e.g. getTokenPriceHistory for time series), so it is clear but not fully routed.

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.