token_price
Fetch real-time USD price for any major token using its symbol or chain and contract address. Returns price, 24h change percent, and market cap.
Instructions
USD spot price for any major token. Pass either symbol (BTC, ETH, SOL, USDC, etc.) OR (chain + contract). Returns USD price, 24h change percent, market cap, fetched-at timestamp. CoinGecko-backed, cached 60s. $0.001 USDC.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | No | Token symbol like 'ETH'. Mutually exclusive with chain+contract. | |
| chain | No | Chain slug: base, ethereum, solana, polygon, arbitrum, optimism, bsc, avalanche. | |
| contract | No | Token contract address. Required with chain. |
Implementation Reference
- index.js:147-159 (registration)Tool registration: defines the 'token_price' tool name, description ('USD spot price for any major token'), and input schema (symbol or chain+contract). Registered in the TOOLS array passed to ListToolsRequestSchema.
{ name: "token_price", description: "USD spot price for any major token. Pass either `symbol` (BTC, ETH, SOL, USDC, etc.) OR (chain + contract). Returns USD price, 24h change percent, market cap, fetched-at timestamp. CoinGecko-backed, cached 60s. $0.001 USDC.", inputSchema: { type: "object", properties: { symbol: { type: "string", description: "Token symbol like 'ETH'. Mutually exclusive with chain+contract." }, chain: { type: "string", description: "Chain slug: base, ethereum, solana, polygon, arbitrum, optimism, bsc, avalanche." }, contract: { type: "string", description: "Token contract address. Required with chain." }, }, }, }, - index.js:151-158 (schema)Input schema for token_price: accepts optional 'symbol' (string), 'chain' (string slug), and 'contract' (string address). symbol is mutually exclusive with chain+contract.
inputSchema: { type: "object", properties: { symbol: { type: "string", description: "Token symbol like 'ETH'. Mutually exclusive with chain+contract." }, chain: { type: "string", description: "Chain slug: base, ethereum, solana, polygon, arbitrum, optimism, bsc, avalanche." }, contract: { type: "string", description: "Token contract address. Required with chain." }, }, }, - index.js:256-265 (handler)Handler logic for the 'token_price' case in buildRequest(): constructs a GET request to `${BASE_URL}/v1/price/token` with query params (symbol, chain, contract) from args. The function is called by the CallToolRequestSchema handler.
case "token_price": { const params = new URLSearchParams(); if (args.symbol) params.set("symbol", args.symbol); if (args.chain) params.set("chain", args.chain); if (args.contract) params.set("contract", args.contract); return { url: `${BASE_URL}/v1/price/token?${params}`, opts: { method: "GET" }, }; }