Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
symbolNoToken symbol like 'ETH'. Mutually exclusive with chain+contract.
chainNoChain slug: base, ethereum, solana, polygon, arbitrum, optimism, bsc, avalanche.
contractNoToken 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." },
        },
      },
    },
  • 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." },
      },
    },
  • 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" },
      };
    }
Behavior5/5

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

No annotations provided, but description fully covers behavior: CoinGecko-backed, cached 60s, cost $0.001 USDC, and returns USD price, 24h change, market cap, and timestamp. No contradictions.

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?

Two sentences packed with all necessary information: purpose, parameters, source, caching, cost, and return fields. No wasted words.

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?

Despite missing output schema, description compensates by listing return fields (price, change %, market cap, timestamp). Covers input options, source, caching, and cost. Fully sufficient for a simple lookup tool.

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 coverage is 100%, so description adds marginal value. It reiterates mutual exclusivity (already in schema) and provides example values, enhancing usability but not essential.

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?

Clearly states it returns USD spot price for major tokens, specifying two input options (symbol or chain+contract). Distinct from siblings which deal with hashes, attestations, decoding, etc.

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?

Explicitly tells agent to pass either 'symbol' OR 'chain+contract', with examples. Does not explicitly exclude alternatives, but siblings are unrelated so usage is clear.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hypeprinter007-stack/anchor-x402-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server