Skip to main content
Glama
lordbasilaiassistant-sudo

base-price-oracle-mcp

get_token_price

Retrieve current token prices from Base blockchain DEX pools including Uniswap V2/V3 and Aerodrome for accurate market valuation.

Instructions

Get current price of any Base token from on-chain DEX pools (Uniswap V2/V3, Aerodrome)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address on Base
quote_currencyNoQuote currency: ETH/WETH or a token addressETH

Implementation Reference

  • The tool 'get_token_price' is registered here. The async function handles the logic: resolving decimals, finding pools, calculating prices across pools, and returning the best price in a JSON format.
    server.tool(
      "get_token_price",
      "Get current price of any Base token from on-chain DEX pools (Uniswap V2/V3, Aerodrome)",
      {
        token_address: z.string().describe("Token contract address on Base"),
        quote_currency: z.string().default("ETH").describe("Quote currency: ETH/WETH or a token address"),
      },
      async ({ token_address, quote_currency }) => {
        try {
          const quoteAddress = resolveQuote(quote_currency);
          const [tokenDecimals, quoteDecimals, tokenSymbol] = await Promise.all([
            getTokenDecimals(token_address),
            getTokenDecimals(quoteAddress),
            getTokenSymbol(token_address),
          ]);
    
          const pools = await findAllPools(token_address, quoteAddress);
          if (pools.length === 0) {
            return { content: [{ type: "text" as const, text: `No DEX pools found for ${token_address} paired with ${quote_currency} on Base.` }] };
          }
    
          const prices = pools.map((pool) => ({
            dex: pool.dex,
            pool: pool.address,
            price: calculatePrice(pool, tokenDecimals, quoteDecimals),
          }));
    
          const bestPool = prices.reduce((best, p) => (p.price > best.price ? p : best), prices[0]);
    
          const result = {
            token: token_address,
            symbol: tokenSymbol,
            quote: quote_currency.toUpperCase(),
            bestPrice: formatEth(bestPool.price),
            bestDex: bestPool.dex,
            allPools: prices.map((p) => ({
              dex: p.dex,
              pool: p.pool,
              price: formatEth(p.price),
            })),
          };
    
          return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] };
        } catch (err: unknown) {
          const msg = err instanceof Error ? err.message : String(err);
          return { content: [{ type: "text" as const, text: `Error: ${msg}` }] };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it mentions the data sources (Uniswap V2/V3, Aerodrome), it doesn't disclose important behavioral traits like rate limits, error conditions (e.g., invalid token addresses), response format, whether it requires authentication, or how it handles tokens not listed on these DEXs. The description is insufficient for a tool that queries on-chain data.

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, efficient sentence with zero wasted words. It's appropriately sized for a straightforward price lookup tool and front-loads the core functionality. Every element (action, resource, data sources) earns its place.

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 the complexity of on-chain price queries and the absence of both annotations and output schema, the description is incomplete. It doesn't explain what the price output looks like (USD equivalent? raw token amount?), how recent 'current' means, or important constraints like which DEX pools are prioritized. For a financial data tool with no structured output documentation, this leaves significant gaps.

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 fully documents both parameters (token_address and quote_currency). The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain token address format requirements, valid quote currency options beyond the default, or how the tool resolves price calculations.

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 current price'), target resource ('any Base token'), and data sources ('on-chain DEX pools (Uniswap V2/V3, Aerodrome)'). It distinguishes itself from siblings like get_price_history (historical data) and get_market_summary (aggregate metrics) by focusing on real-time price retrieval from specific DEX sources.

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 real-time price queries on Base tokens from DEX pools, but provides no explicit guidance on when to use this tool versus alternatives like compare_prices (multiple token comparison) or get_price_impact (slippage analysis). It lacks explicit when-not-to-use criteria or prerequisite information about token availability.

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/lordbasilaiassistant-sudo/base-price-oracle-mcp'

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