Skip to main content
Glama
lordbasilaiassistant-sudo

base-price-oracle-mcp

get_market_summary

Retrieve a comprehensive market report for Base tokens including price, volume estimates, liquidity, and volatility metrics to analyze token performance.

Instructions

Combined report: price, volume estimate, liquidity, volatility for a token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address on Base

Implementation Reference

  • Tool registration and handler implementation for 'get_market_summary' which retrieves market data including price, liquidity, volume estimate, and volatility for a given token address.
    server.tool(
      "get_market_summary",
      "Combined report: price, volume estimate, liquidity, volatility for a token",
      {
        token_address: z.string().describe("Token contract address on Base"),
      },
      async ({ token_address }) => {
        try {
          const quoteAddress = WETH;
          const [tokenDecimals, quoteDecimals, tokenSymbol, tokenName] = await Promise.all([
            getTokenDecimals(token_address),
            getTokenDecimals(quoteAddress),
            getTokenSymbol(token_address),
            (async () => {
              try {
                const c = new ethers.Contract(token_address, ERC20_ABI, provider);
                return await c.name();
              } catch {
                return "Unknown";
              }
            })(),
          ]);
    
          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.` }] };
          }
    
          // Best price
          const prices = pools.map((p) => ({
            dex: p.dex,
            price: calculatePrice(p, tokenDecimals, quoteDecimals),
          }));
          const bestPrice = prices.reduce((best, p) => (p.price > best.price ? p : best), prices[0]);
    
          // Liquidity summary
          let totalEthLiquidity = 0;
          for (const pool of pools) {
            if (pool.sqrtPriceX96 === undefined) {
              const ethRes = pool.tokenIsToken0
                ? Number(ethers.formatUnits(pool.reserve1, quoteDecimals))
                : Number(ethers.formatUnits(pool.reserve0, quoteDecimals));
              totalEthLiquidity += ethRes * 2;
            }
          }
    
          // Recent swaps for volume + volatility (last ~6 hours = ~10800 blocks)
          const lookbackBlocks = 10800;
          const swaps = await getSwapHistory(pools[0], tokenDecimals, quoteDecimals, lookbackBlocks);
          const swapPrices = swaps.map((s) => s.price);
          const returns = calculateReturns(swapPrices);
          const vol = stddev(returns);
    
          // Estimate volume from swap count (rough)
          const volumeEstimate = swaps.length > 0
            ? `~${swaps.length} swaps in last 6h`
            : "No recent swaps";
    
          // Total supply
          let totalSupply = "Unknown";
          try {
            const c = new ethers.Contract(token_address, ERC20_ABI, provider);
            const supply = await c.totalSupply();
            totalSupply = Number(ethers.formatUnits(supply, tokenDecimals)).toLocaleString();
          } catch {
            // ignore
          }
    
          const summary = {
            token: {
              address: token_address,
              name: tokenName,
              symbol: tokenSymbol,
              decimals: tokenDecimals,
              totalSupply,
            },
            price: {
              current: formatEth(bestPrice.price),
              dex: bestPrice.dex,
              poolCount: pools.length,
            },
            liquidity: {
              totalValueETH: formatEth(totalEthLiquidity),
              pools: pools.map((p) => p.dex).join(", "),
            },
            volume: volumeEstimate,
            volatility: swapPrices.length >= 3
              ? {
                  perSwap: (vol * 100).toFixed(4) + "%",
                  annualized: (vol * Math.sqrt(365 * 24) * 100).toFixed(2) + "%",
                  swapCount: swaps.length,
                }
              : "Insufficient swap data",
            priceRange6h: swapPrices.length > 0
              ? {
                  low: formatEth(Math.min(...swapPrices)),
                  high: formatEth(Math.max(...swapPrices)),
                }
              : "No data",
          };
    
          return {
            content: [{
              type: "text" as const,
              text: JSON.stringify(summary, 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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the report includes price, volume estimate, liquidity, and volatility, but does not specify data sources, update frequency, accuracy, rate limits, or error handling. For a tool with no annotations, 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads key information ('Combined report') and lists the metrics concisely. It avoids unnecessary words, though it could be slightly more structured (e.g., by clarifying the report's format or output).

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 providing multiple financial metrics, lack of annotations, and no output schema, the description is incomplete. It does not explain the return format, units of measurement, or how metrics are calculated, which are critical for a combined report tool. This leaves the agent with insufficient context to use the tool effectively.

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 input schema has 100% description coverage, with the parameter 'token_address' clearly documented. The description adds minimal value beyond the schema by implying the token is the target, but does not provide additional context such as token format examples or validation rules. Baseline 3 is appropriate given the high schema coverage.

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: to provide a combined report with specific metrics (price, volume estimate, liquidity, volatility) for a token. It uses a specific verb ('Combined report') and resource ('for a token'), but does not explicitly differentiate from sibling tools like get_token_price or get_liquidity_depth, which offer similar or overlapping functionality.

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. It does not mention sibling tools like get_token_price or get_liquidity_depth, nor does it specify contexts where this combined report is preferable over individual metric tools. Usage is implied by the report's comprehensiveness, but no explicit when/when-not instructions are given.

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