Skip to main content
Glama

token_price

Retrieve current price, market cap, and 24-hour trading volume for Hedera tokens using a HederaIntel API key and token ID.

Instructions

Get the current price, market cap, and 24h trading volume for a Hedera token. Costs 0.05 HBAR.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesYour HederaIntel API key
token_idYesHedera token ID (e.g. 0.0.123456)

Implementation Reference

  • Handler for the token_price tool. Fetches token data, holder counts, and price information from Hedera mirror node and SaucerSwap API.
    if (name === "token_price") {
      const payment = chargeForTool("token_price", args.api_key);
      const base = getMirrorNodeBase();
    
      // Fetch token metadata from mirror node
      const tokenRes = await axios.get(`${base}/api/v1/tokens/${args.token_id}`);
      const token = tokenRes.data;
      const decimals = parseInt(token.decimals || 0);
      const totalSupply = parseInt(token.total_supply || 0);
      const adjustedSupply = totalSupply / Math.pow(10, decimals);
    
      // Fetch holder count — fetch max and sort client-side by balance desc
      const balRes = await axios.get(
        `${base}/api/v1/tokens/${args.token_id}/balances?limit=100&account.balance.gt=0`
      ).catch(() => ({ data: { balances: [] } }));
      const holders = (balRes.data.balances || []).sort((a, b) => parseInt(b.balance || 0) - parseInt(a.balance || 0));
    
      // Fetch all tokens + price change data in parallel
      const [saucerTokens, priceChangeMap, defaultTokens] = await Promise.all([
        getSaucerSwapTokens(),
        getSaucerSwapPriceChange(),
        getSaucerSwapDefaultTokens(),
      ]);
      const saucerToken = saucerTokens.find(t => t.id === args.token_id);
      const defaultToken = defaultTokens.find(t => t.id === args.token_id);
    
      // Convert price from tinybars to HBAR
      let priceHbar = null;
      let priceUsd = null;
      if (saucerToken?.price) {
        priceHbar = (parseInt(saucerToken.price) / 100000000).toFixed(8);
        priceUsd = saucerToken.priceUsd || null;
      }
    
      // 24h price change from /tokens/price-change map
      const rawChange = priceChangeMap[args.token_id];
      const priceChange24h = rawChange != null ? rawChange.toFixed(2) + "%" : null;
    
      // Extended data from /tokens/default (only available for default-listed tokens)
      const liquidityUsd = defaultToken?.liquidityUsd || null;
      const priceChangeHour = defaultToken?.priceChangeHour != null ? defaultToken.priceChangeHour.toFixed(2) + "%" : null;
      const priceChangeWeek = defaultToken?.priceChangeWeek != null ? defaultToken.priceChangeWeek.toFixed(2) + "%" : null;
    
      return {
        token_id: args.token_id,
        name: token.name || "Unknown",
        symbol: token.symbol || "?",
        decimals,
        total_supply: adjustedSupply.toLocaleString(),
        type: token.type || "FUNGIBLE_COMMON",
        treasury: token.treasury_account_id,
        holder_count: holders.length,
        price_hbar: priceHbar,
        price_usd: priceUsd,
        price_change_1h_pct: priceChangeHour,
        price_change_24h_pct: priceChange24h,
        price_change_7d_pct: priceChangeWeek,
        liquidity_usd: liquidityUsd ? "$" + liquidityUsd.toLocaleString() : null,
        price_source: saucerToken ? "SaucerSwap DEX" : "Not listed on SaucerSwap DEX",
        due_diligence_complete: saucerToken?.dueDiligenceComplete ?? null,
        created_timestamp: token.created_timestamp,
        memo: token.memo || null,
        payment,
        timestamp: new Date().toISOString(),
      };
    }
  • Input schema definition for the token_price tool.
    {
      name: "token_price",
      description: "Get the current price, market cap, and 24h trading volume for a Hedera token. Costs 0.1 HBAR.",
      inputSchema: {
        type: "object",
        properties: {
          token_id: { type: "string", description: "Hedera token ID (e.g. 0.0.123456)" },
          api_key: { type: "string", description: "Your HederaIntel API key" },
        },
        required: ["token_id", "api_key"],
      },
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates that this is a read operation (implied by 'Get'), discloses the cost ('Costs 0.05 HBAR'), and specifies the data returned (price, market cap, volume). However, it does not mention potential errors, rate limits, or authentication requirements beyond the api_key parameter.

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?

The description is front-loaded with the core purpose in the first sentence and efficiently adds cost information in the second. Both sentences earn their place by providing essential information without redundancy or unnecessary details.

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?

Given the tool's moderate complexity (2 required parameters, no output schema, no annotations), the description is reasonably complete. It covers the purpose, returned data, and cost, but could improve by addressing error handling, response format, or usage constraints relative to siblings.

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 the schema already documents both parameters (api_key and token_id). The description does not add any additional meaning or context about the parameters beyond what the schema provides, such as format examples for token_id or usage instructions for api_key.

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?

The description clearly states the specific action ('Get') and the resources involved ('current price, market cap, and 24h trading volume for a Hedera token'), distinguishing it from sibling tools like token_analyze or token_monitor by focusing on real-time pricing data rather than analysis or monitoring.

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?

The description implies usage for retrieving token pricing data but does not explicitly state when to use this tool versus alternatives like token_analyze or token_monitor. It mentions the cost ('Costs 0.05 HBAR'), which provides some context for decision-making, but lacks explicit guidance on prerequisites or exclusions.

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/mountainmystic/hederatoolbox'

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