Skip to main content
Glama
lordbasilaiassistant-sudo

base-price-oracle-mcp

compare_prices

Compare token prices across multiple DEX pools on Base to identify arbitrage opportunities by analyzing price differences.

Instructions

Compare a token's price across multiple DEX pools to find arbitrage opportunities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address on Base

Implementation Reference

  • The handler logic for 'compare_prices' which fetches token decimals, identifies DEX pools, and calculates/compares prices across them.
    async ({ token_address }) => {
      try {
        const quoteAddress = WETH;
        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} on Base.` }] };
        }
    
        if (pools.length === 1) {
          const price = calculatePrice(pools[0], tokenDecimals, quoteDecimals);
          return {
            content: [{
              type: "text" as const,
              text: JSON.stringify({
                token: token_address,
                symbol: tokenSymbol,
                message: "Only one pool found. No cross-DEX comparison possible.",
                pool: { dex: pools[0].dex, address: pools[0].address, price: formatEth(price) },
              }, null, 2),
            }],
          };
        }
    
        const priceData = pools
          .map((pool) => ({
            dex: pool.dex,
            pool: pool.address,
            price: calculatePrice(pool, tokenDecimals, quoteDecimals),
          }))
          .filter((p) => p.price > 0)
          .sort((a, b) => a.price - b.price);
    
        if (priceData.length < 2) {
          return { content: [{ type: "text" as const, text: "Not enough pools with valid prices to compare." }] };
        }
  • src/index.ts:824-829 (registration)
    Registration of the 'compare_prices' tool.
    server.tool(
      "compare_prices",
      "Compare a token's price across multiple DEX pools to find arbitrage opportunities",
      {
        token_address: z.string().describe("Token contract address on Base"),
      },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool compares prices across DEX pools for arbitrage, but doesn't detail key behaviors such as rate limits, authentication needs, whether it's read-only or has side effects, or how results are returned (e.g., format, pagination). This leaves significant gaps for an agent to understand operational constraints.

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 that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly. Every part of the sentence contributes to understanding the tool's function.

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 price comparison and arbitrage analysis, the description is incomplete. No annotations exist to cover behavioral aspects, and there's no output schema to explain return values. The description lacks details on what the comparison entails (e.g., which DEX pools, time frames, or metrics), making it insufficient for an agent to fully grasp the tool's functionality and limitations.

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 description doesn't add any parameter-specific information beyond what the input schema provides. The schema has 100% coverage with a clear description for 'token_address' as 'Token contract address on Base.' Since schema coverage is high, the baseline score is 3, as the description doesn't compensate but also doesn't detract from the schema's documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Compare a token's price across multiple DEX pools to find arbitrage opportunities.' It specifies the verb (compare), resource (token's price), and context (across multiple DEX pools). However, it doesn't explicitly distinguish this from sibling tools like 'get_token_price' or 'get_price_history,' which reduces it from a perfect score.

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 minimal guidance on when to use this tool. It implies usage for arbitrage opportunities but doesn't specify when to choose this over alternatives like 'get_token_price' (which might fetch a single price) or 'get_price_history' (which tracks price over time). No explicit when/when-not instructions or prerequisites are mentioned.

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