Skip to main content
Glama

get_cardano_price

Retrieve aggregated price for Cardano native tokens from DEX liquidity pools using ADA bridge pricing.

Instructions

Get aggregated price for a Cardano native token from DEX liquidity pools (TOKEN/USDT via ADA bridge)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesCardano token symbol (INDY, SNEK, MIN, NIGHT)

Implementation Reference

  • Main implementation of get_cardano_price tool - registers the tool with MCP server and contains the handler logic that fetches ADA price from multiple CEX sources (Binance, MEXC, Coingecko), retrieves Cardano DEX liquidity pools from Iris API, calculates token price weighted by TVL, and returns aggregated USDT price with confidence score.
    export function registerCardanoTools(server: McpServer): void {
      server.tool(
        'get_cardano_price',
        'Get aggregated price for a Cardano native token from DEX liquidity pools (TOKEN/USDT via ADA bridge)',
        {
          symbol: z.string().describe('Cardano token symbol (INDY, SNEK, MIN, NIGHT)'),
        },
        async ({ symbol }) => {
          const upper = symbol.toUpperCase();
          const token = SUPPORTED_TOKENS[upper];
          if (!token) {
            throw new Error(
              `Unsupported token: ${symbol}. Supported: ${Object.keys(SUPPORTED_TOKENS).join(', ')}`
            );
          }
    
          const [adaPrice, allPools] = await Promise.all([fetchADAUSDT(), fetchIrisPools()]);
    
          const tokenPools = allPools
            .filter((p: any) => matchesToken(p, token.policyId))
            .filter((p: any) => (p.state?.tvl || 0) >= token.minLiquidity)
            .sort((a: any, b: any) => (b.state?.tvl || 0) - (a.state?.tvl || 0))
            .slice(0, 3);
    
          if (tokenPools.length === 0) {
            throw new Error(`No liquidity pools found for ${upper} above minimum TVL threshold`);
          }
    
          const identifiers = tokenPools.map((p: any) => p.identifier).filter(Boolean);
          let tokenAdaPrice: number;
    
          if (identifiers.length > 0) {
            const prices = await fetchIrisPrices(identifiers);
            if (prices.length > 0) {
              const totalTvl = tokenPools.reduce((sum: number, p: any) => sum + (p.state?.tvl || 0), 0);
              tokenAdaPrice = tokenPools.reduce((sum: number, p: any, i: number) => {
                const weight = (p.state?.tvl || 0) / totalTvl;
                return sum + (prices[i] || 0) * weight;
              }, 0);
            } else {
              tokenAdaPrice =
                tokenPools.reduce((sum: number, p: any) => sum + (p.state?.price || 0), 0) /
                tokenPools.length;
            }
          } else {
            tokenAdaPrice =
              tokenPools.reduce((sum: number, p: any) => sum + (p.state?.price || 0), 0) /
              tokenPools.length;
          }
    
          const tokenUsdtPrice = tokenAdaPrice * adaPrice.price;
          const confidence = Math.min(tokenPools.length / 3, 1);
    
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(
                  {
                    symbol: `${upper}/USDT`,
                    price: tokenUsdtPrice,
                    tokenAdaPrice,
                    adaUsdtPrice: adaPrice.price,
                    confidence,
                    poolsUsed: tokenPools.length,
                    sources: {
                      ada: adaPrice.sources,
                      pools: tokenPools.map((p: any) => ({
                        dex: p.dex || 'unknown',
                        tvl: p.state?.tvl,
                      })),
                    },
                    timestamp: new Date().toISOString(),
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
      );
  • Input schema for get_cardano_price tool - accepts a 'symbol' parameter (string) describing the Cardano token symbol (INDY, SNEK, MIN, NIGHT) using Zod validation.
      symbol: z.string().describe('Cardano token symbol (INDY, SNEK, MIN, NIGHT)'),
    },
  • Registration point where registerCardanoTools is called within the main registerTools function, which is invoked during server initialization to register all tools including get_cardano_price.
    export function registerTools(server: McpServer): void {
      registerMarketDataTools(server);
      registerAccountTools(server);
      registerTradingTools(server);
      registerCardanoTools(server);
      registerStrategyTools(server);
    }
  • Helper function fetchADAUSDT that aggregates ADA/USDT prices from multiple centralized exchange endpoints (Binance, MEXC, Coingecko) with 5-second timeout, filtering valid prices and returning average with source list.
    async function fetchADAUSDT(): Promise<{ price: number; sources: string[] }> {
      const prices: number[] = [];
      const sources: string[] = [];
    
      for (const endpoint of CEX_ENDPOINTS) {
        try {
          const resp = await fetch(endpoint.url, { signal: AbortSignal.timeout(5000) });
          if (!resp.ok) continue;
          const data = await resp.json();
          const price = endpoint.parse(data);
          if (price > 0 && !isNaN(price)) {
            prices.push(price);
            sources.push(endpoint.name);
          }
        } catch {
          // skip failed endpoint
        }
      }
    
      if (prices.length === 0) {
        throw new Error('Failed to fetch ADA/USDT price from any CEX source');
      }
    
      return {
        price: prices.reduce((sum, p) => sum + p, 0) / prices.length,
        sources,
      };
    }
  • Helper function fetchIrisPools that retrieves Cardano DEX liquidity pools from the Indigo Protocol Iris API with 10-second timeout and User-Agent header.
    async function fetchIrisPools(): Promise<any[]> {
      const resp = await fetch(`${IRIS_BASE_URL}/api/liquidity-pools`, {
        headers: { 'User-Agent': 'OpenMM-MCP-Agent/1.0' },
        signal: AbortSignal.timeout(10000),
      });
      if (!resp.ok) {
        throw new Error(`Iris API error: ${resp.status}`);
      }
      const data = await resp.json();
      return data?.data || data || [];
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral disclosure. It mentions 'aggregated price from DEX liquidity pools' which implies read-only data fetching, but doesn't cover rate limits, data freshness, error conditions, authentication needs, or what 'aggregated' means computationally. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.

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 a single, dense sentence with zero wasted words. Every element ('Get aggregated price', 'Cardano native token', 'DEX liquidity pools', 'TOKEN/USDT via ADA bridge') serves a specific informational purpose. It's front-loaded with the core purpose and efficiently conveys the essential details.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a single parameter with good schema coverage, the description is incomplete. It doesn't explain what the aggregated price represents (weighted average? median?), how frequently it updates, what format the return value takes, or potential error scenarios. For a financial data tool, this leaves too much unspecified about the tool's behavior and output.

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?

The schema has 100% description coverage for its single parameter, so the baseline is 3. The description adds marginal value by listing example token symbols (INDY, SNEK, MIN, NIGHT) which helps clarify the 'symbol' parameter's expected values, but doesn't provide additional semantic context beyond what the schema already documents.

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 aggregated price') and resource ('Cardano native token'), specifying the exact mechanism ('from DEX liquidity pools') and context ('TOKEN/USDT via ADA bridge'). It distinguishes itself from sibling tools like get_ticker or get_orderbook by focusing on aggregated token pricing rather than market data or order books.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like get_ticker (which might provide broader market data) or get_orderbook (which shows depth). It mentions the specific token types (INDY, SNEK, MIN, NIGHT) but doesn't explain why this tool is preferred for aggregated pricing over other price-related tools in the sibling list.

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/QBT-Labs/openmm-mcp'

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