Skip to main content
Glama

Query DEX Pairs

query_dex_pairs

Retrieve available trading pairs from decentralized exchanges. Filter by blockchain, base token, or quote token to get liquidity and volume data.

Instructions

List available trading pairs on decentralized exchanges. Filter by chain, base token, or quote token. Returns pair details with liquidity and volume. Cost: $0.001 per query. Source: On-chain DEX analytics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoFilter by blockchain network
base_tokenNoFilter by base token symbol (e.g. WETH)
quote_tokenNoFilter by quote token symbol (e.g. USDC)
limitNoMaximum results (default 25)

Implementation Reference

  • The async handler function that executes the 'query_dex_pairs' tool logic. Calls apiGet('/api/v1/dex/pairs') with optional chain, base_token, quote_token, and limit parameters, then formats the response.
      async ({ chain, base_token, quote_token, limit }) => {
        const res = await apiGet<DexQueryResponse>("/api/v1/dex/pairs", {
          chain,
          base_token,
          quote_token,
          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 pair(s).`;
        const json = JSON.stringify(data, null, 2);
    
        return {
          content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
        };
      },
    );
  • Input schema for 'query_dex_pairs' using Zod. Defines optional parameters: chain (enum of chains), base_token, quote_token, and limit (1-100, default 25).
    {
      title: "Query DEX Pairs",
      description:
        "List available trading pairs on decentralized exchanges. Filter by chain, " +
        "base token, or quote token. Returns pair details with liquidity and volume. " +
        "Cost: $0.001 per query. Source: On-chain DEX analytics.",
      inputSchema: {
        chain: z
          .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"])
          .optional()
          .describe("Filter by blockchain network"),
        base_token: z
          .string()
          .optional()
          .describe("Filter by base token symbol (e.g. WETH)"),
        quote_token: z
          .string()
          .optional()
          .describe("Filter by quote token symbol (e.g. USDC)"),
        limit: z
          .number()
          .int()
          .min(1)
          .max(100)
          .optional()
          .describe("Maximum results (default 25)"),
      },
    },
  • Registration of 'query_dex_pairs' tool via server.registerTool() with the tool name string 'query_dex_pairs', schema, and handler.
    server.registerTool(
      "query_dex_pairs",
      {
        title: "Query DEX Pairs",
        description:
          "List available trading pairs on decentralized exchanges. Filter by chain, " +
          "base token, or quote token. Returns pair details with liquidity and volume. " +
          "Cost: $0.001 per query. Source: On-chain DEX analytics.",
        inputSchema: {
          chain: z
            .enum(["ethereum", "arbitrum", "polygon", "base", "bsc"])
            .optional()
            .describe("Filter by blockchain network"),
          base_token: z
            .string()
            .optional()
            .describe("Filter by base token symbol (e.g. WETH)"),
          quote_token: z
            .string()
            .optional()
            .describe("Filter by quote token symbol (e.g. USDC)"),
          limit: z
            .number()
            .int()
            .min(1)
            .max(100)
            .optional()
            .describe("Maximum results (default 25)"),
        },
      },
      async ({ chain, base_token, quote_token, limit }) => {
        const res = await apiGet<DexQueryResponse>("/api/v1/dex/pairs", {
          chain,
          base_token,
          quote_token,
          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 pair(s).`;
        const json = JSON.stringify(data, null, 2);
    
        return {
          content: [{ type: "text" as const, text: `${summary}\n\n${json}` }],
        };
      },
    );
  • stalenessWarning helper used by the handler to check for stale data headers.
    export function stalenessWarning(res: ApiResponse): string {
      if (!res.stale) return "";
      const parts = ["[STALE DATA]"];
      if (res.lastUpdated) parts.push(`Last updated: ${res.lastUpdated}`);
      if (res.ageSeconds != null) parts.push(`Age: ${res.ageSeconds}s`);
      return parts.join(" ") + "\n\n";
    }
  • apiGet helper used by the handler to make HTTP GET requests to the Verilex API.
    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,
      };
    }
Behavior3/5

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

Discloses cost ($0.001 per query) and source (on-chain DEX analytics), but with no annotations, it misses other common behavioral traits like idempotency, permissions, or side effects. Implies read-only.

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?

Three concise sentences with clear front-loading: purpose, filters, and output plus cost/source. No unnecessary words.

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

Completeness4/5

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

Given no output schema, describes return fields (liquidity, volume) and includes source and cost. Could mention pagination or ordering but adequately covers basics for a listing tool.

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 descriptions cover 100% of parameters, and the description adds minimal new param info beyond reiterating the filters. The extra context (cost, source) is not parameter-specific.

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?

Clearly states the tool lists available trading pairs on DEXs and specifies filtering by chain, base/quote token. Distinguishes from siblings like query_dex_trades by mentioning returns of pair details with liquidity and volume.

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?

Implied usage for listing DEX pairs, but no explicit when-to-use vs alternatives or exclusions. Does not mention sibling tools like query_dex_trades for trades.

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