Skip to main content
Glama

Query DEX Volume

query_dex_volume

Retrieve DEX trading pair volume statistics including 24h and 7d volume, trade count, and trends across multiple blockchains.

Instructions

Get volume statistics for DEX trading pairs. Shows 24h volume, 7d volume, trade count, and volume trends by pair and chain. Cost: $0.005 per query. Source: On-chain DEX analytics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pairNoTrading pair (e.g. WETH-USDC)
chainNoFilter by blockchain network
periodNoVolume aggregation period (default: 24h)
limitNoMaximum results (default 25)

Implementation Reference

  • src/tools/dex.ts:29-97 (registration)
    The registerDexTools function is called from src/index.ts line 52, registering all DEX tools including query_dex_volume on the MCP server.
    export function registerDexTools(server: McpServer): void {
      // ── Query DEX trades ──────────────────────────────────────────────────
    
      server.registerTool(
        "query_dex_trades",
        {
          title: "Query DEX Trades",
          description:
            "Get recent swap transactions on decentralized exchanges. Filter by trading pair, " +
            "chain, minimum size, and DEX protocol. Returns trade details including price, " +
            "size, slippage, and maker/taker addresses. " +
            "Cost: $0.003 per query. Source: On-chain DEX analytics.",
          inputSchema: {
            pair: z
              .string()
              .optional()
              .describe("Trading pair (e.g. WETH-USDC)"),
            chain: z
              .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"])
              .optional()
              .describe("Filter by blockchain network"),
            dex: z
              .string()
              .optional()
              .describe("Filter by DEX protocol (e.g. uniswap_v3, sushiswap)"),
            min_usd: z
              .number()
              .optional()
              .describe("Minimum trade size in USD"),
            limit: z
              .number()
              .int()
              .min(1)
              .max(100)
              .optional()
              .describe("Maximum results (default 25)"),
          },
        },
        async ({ pair, chain, dex, min_usd, limit }) => {
          const res = await apiGet<DexQueryResponse>("/api/v1/dex/trades", {
            pair,
            chain,
            dex,
            min_usd,
            limit: limit ?? 25,
          });
    
          if (!res.ok) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `API error (${res.status}): ${JSON.stringify(res.data)}`,
                },
              ],
              isError: true,
            };
          }
    
          const { count, data } = res.data;
          const warn = stalenessWarning(res);
          const summary = `${warn}Found ${count} DEX trade(s).`;
          const json = JSON.stringify(data, null, 2);
    
          return {
            content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
          };
        },
      );
  • The handler for query_dex_volume tool: calls apiGet to /api/v1/dex/volume with optional pair, chain, period, and limit parameters, returns volume statistics.
    // ── Query DEX volume ──────────────────────────────────────────────────
    
    server.registerTool(
      "query_dex_volume",
      {
        title: "Query DEX Volume",
        description:
          "Get volume statistics for DEX trading pairs. Shows 24h volume, 7d volume, " +
          "trade count, and volume trends by pair and chain. " +
          "Cost: $0.005 per query. Source: On-chain DEX analytics.",
        inputSchema: {
          pair: z
            .string()
            .optional()
            .describe("Trading pair (e.g. WETH-USDC)"),
          chain: z
            .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"])
            .optional()
            .describe("Filter by blockchain network"),
          period: z
            .enum(["24h", "7d", "30d"])
            .optional()
            .describe("Volume aggregation period (default: 24h)"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .optional()
            .describe("Maximum results (default 25)"),
        },
      },
      async ({ pair, chain, period, limit }) => {
        const res = await apiGet<DexQueryResponse>("/api/v1/dex/volume", {
          pair,
          chain,
          period: period ?? "24h",
          limit: limit ?? 25,
        });
    
        if (!res.ok) {
          return {
            content: [
              {
                type: "text" as const,
                text: `API error (${res.status}): ${JSON.stringify(res.data)}`,
              },
            ],
            isError: true,
          };
        }
    
        const { count, data } = res.data;
        const warn = stalenessWarning(res);
        const summary = `${warn}Found ${count} DEX volume record(s).`;
        const json = JSON.stringify(data, null, 2);
    
        return {
          content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
        };
      },
    );
  • Input schema for query_dex_volume: optional pair (string), chain (enum: ethereum, arbitrum, polygon, base, bsc), period (enum: 24h, 7d, 30d), and limit (int 1-100).
    inputSchema: {
      pair: z
        .string()
        .optional()
        .describe("Trading pair (e.g. WETH-USDC)"),
      chain: z
        .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"])
        .optional()
        .describe("Filter by blockchain network"),
      period: z
        .enum(["24h", "7d", "30d"])
        .optional()
        .describe("Volume aggregation period (default: 24h)"),
      limit: z
        .number()
        .int()
        .min(1)
        .max(100)
        .optional()
        .describe("Maximum results (default 25)"),
    },
  • src/index.ts:52-58 (registration)
    Top-level registration: registerDexTools(server) is called in the MCP server setup in src/index.ts line 52.
    registerDexTools(server);
    registerContractTools(server);
    registerPmTools(server);
    registerPmArbTools(server);
    registerPmResolutionTools(server);
    registerEconTools(server);
    registerPmMicroTools(server);
  • The apiGet helper function used by the handler to make HTTP GET requests to the Verilex API backend (calls /api/v1/dex/volume).
    export async function apiGet<T = unknown>(
      path: string,
      params?: Record<string, string | number | undefined>,
    ): Promise<ApiResponse<T>> {
      const url = buildUrl(path, params);
    
      const headers: Record<string, string> = {
        Accept: "application/json",
        "User-Agent": "verilex-mcp-server/0.1.0",
      };
    
      // Forward x402 payment token if present in env (for paid endpoints)
      const paymentToken = process.env.VERILEX_PAYMENT_TOKEN;
      if (paymentToken) {
        headers["X-Payment-Token"] = paymentToken;
      }
    
      const res = await fetch(url, { headers });
      const data = (await res.json()) as T;
    
      const stale = res.headers.get("X-Data-Stale");
      const lastUpdated = res.headers.get("X-Data-Last-Updated");
      const ageSeconds = res.headers.get("X-Data-Age-Seconds");
    
      return {
        ok: res.ok,
        status: res.status,
        data,
        stale: stale === "true",
        lastUpdated: lastUpdated ?? undefined,
        ageSeconds: ageSeconds ? Number(ageSeconds) : undefined,
      };
    }
Behavior2/5

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

With no annotations provided, description carries full burden for behavioral disclosure. It only mentions cost ($0.005 per query) and source (on-chain analytics), but omits critical details like rate limits, data freshness, or read-only nature. No confirmation that operation is non-destructive.

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?

Two sentences efficiently convey purpose and cost/source. Information is front-loaded with the main action. Could be slightly more concise by merging the cost sentence, but overall clear and compact.

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

Completeness3/5

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

Description lists metrics included but does not specify the output structure or field names, which is important since no output schema is provided. With four parameters and no return format details, the description is adequate but incomplete for full contextual understanding.

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?

Input schema has 100% description coverage; each parameter is already documented with examples and enums. The tool description adds no additional semantic value beyond what the schema provides, earning the baseline score of 3 for high coverage.

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?

Description clearly states the tool retrieves volume statistics for DEX trading pairs, listing specific metrics (24h volume, 7d volume, trade count, volume trends) and sourcing. It distinguishes from sibling tools like query_dex_pairs and query_dex_trades by focusing solely on volume data.

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?

Description implies usage for DEX volume queries but provides no explicit when-to-use or when-not-to-use guidance compared to alternatives. It mentions cost and source but lacks directives on suitable contexts or exclusions.

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/carrierone/verilexdata-mcp'

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