Skip to main content
Glama
lordbasilaiassistant-sudo

base-flash-arb-mcp

scan_top_tokens

Scans top traded tokens on Base blockchain for arbitrage opportunities by analyzing price gaps across DEXes using DexScreener data.

Instructions

Scan top traded tokens on Base for arb opportunities using DexScreener.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
min_liquidity_ethNoMinimum liquidity in ETH (default 1)
limitNoMax tokens to scan (default 20)

Implementation Reference

  • The handler function that executes the `scan_top_tokens` tool. It fetches token data from DexScreener, filters by liquidity, and returns the top tokens.
    async ({ min_liquidity_eth, limit }) => {
      try {
        // Fetch trending tokens on Base from DexScreener
        const response = await fetch(
          "https://api.dexscreener.com/latest/dex/search?q=WETH&chain=base"
        );
        const data = (await response.json()) as {
          pairs?: Array<{
            baseToken: { address: string; symbol: string; name: string };
            liquidity?: { usd: number };
            priceNative?: string;
            volume?: { h24: number };
            txns?: { h24: { buys: number; sells: number } };
          }>;
        };
    
        if (!data.pairs || data.pairs.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: "No pairs found on DexScreener for Base chain.",
              },
            ],
          };
        }
    
        // Deduplicate by token address, filter by min liquidity
        const ethPrice = 2500; // approximate for liquidity conversion
        const minLiqUsd = min_liquidity_eth * ethPrice;
        const seen = new Set<string>();
        const tokens: Array<{
          address: string;
          symbol: string;
          name: string;
          liquidityUsd: number;
          volume24h: number;
        }> = [];
    
        for (const pair of data.pairs) {
          const addr = pair.baseToken.address.toLowerCase();
          if (seen.has(addr)) continue;
          if (addr === WETH.toLowerCase()) continue;
          seen.add(addr);
    
          const liqUsd = pair.liquidity?.usd ?? 0;
          if (liqUsd < minLiqUsd) continue;
    
          tokens.push({
            address: pair.baseToken.address,
            symbol: pair.baseToken.symbol,
            name: pair.baseToken.name,
            liquidityUsd: liqUsd,
            volume24h: pair.volume?.h24 ?? 0,
          });
    
          if (tokens.length >= limit) break;
        }
    
        // Scan each token for arb opportunities
        const gasCost = await estimateGasCost();
        const testAmount = ethers.parseEther("0.01");
        const results = [];
    
        for (const token of tokens.slice(0, limit)) {
          try {
            const buyQuotes = await getAllBuyQuotes(token.address, testAmount);
  • src/index.ts:859-868 (registration)
    Registration of the `scan_top_tokens` tool, defining its schema and description.
    server.tool(
      "scan_top_tokens",
      "Scan top traded tokens on Base for arb opportunities using DexScreener.",
      {
        min_liquidity_eth: z
          .number()
          .default(1)
          .describe("Minimum liquidity in ETH (default 1)"),
        limit: z.number().default(20).describe("Max tokens to scan (default 20)"),
      },
Behavior2/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 mentions scanning for 'arb opportunities' but does not clarify what constitutes an opportunity, how results are returned, or any operational constraints (e.g., rate limits, data freshness). The description lacks details on the tool's behavior beyond the basic action, leaving significant gaps for an AI agent.

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 front-loads the core purpose without unnecessary words. It directly communicates the tool's function and method, making it easy to parse and understand quickly. Every part of the sentence contributes meaning, earning a high score for conciseness.

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 scanning for arbitrage opportunities, the description is insufficient. With no annotations and no output schema, it fails to explain what the tool returns (e.g., list of tokens, opportunity details) or any behavioral traits. The description does not compensate for these gaps, making it incomplete for effective tool invocation by an AI agent.

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 clear defaults and meanings for both parameters (min_liquidity_eth and limit). The description does not add any parameter-specific information beyond what the schema provides, such as typical values or usage context. Given the high schema coverage, a baseline score of 3 is appropriate, as the description neither compensates nor detracts.

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: 'Scan top traded tokens on Base for arb opportunities using DexScreener.' It specifies the verb (scan), resource (top traded tokens on Base), and goal (for arb opportunities), with the method (using DexScreener) adding useful context. However, it does not explicitly differentiate from sibling tools like 'detect_arb_opportunity' or 'get_price_across_dexes', which prevents a score of 5.

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 mentions 'arb opportunities' but does not specify scenarios, prerequisites, or exclusions, nor does it reference sibling tools like 'detect_arb_opportunity' for comparison. This lack of contextual direction limits its utility for an AI agent in selecting the appropriate tool.

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-flash-arb-mcp'

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