query_dex_trades
Retrieve recent decentralized exchange swap transactions with filters for trading pair, blockchain network, DEX protocol, and minimum trade size. Provides trade details including price, size, slippage, and participant addresses.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | No | Trading pair (e.g. WETH-USDC) | |
| chain | No | Filter by blockchain network | |
| dex | No | Filter by DEX protocol (e.g. uniswap_v3, sushiswap) | |
| min_usd | No | Minimum trade size in USD | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/dex.ts:67-96 (handler)Handler logic for the "query_dex_trades" tool. It calls the /api/v1/dex/trades endpoint and formats the output.
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}` }], }; }, - src/tools/dex.ts:32-66 (registration)Registration of the "query_dex_trades" tool with its schema definition and input validation.
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)"), }, },