getPoolTransactions
Retrieve recent transaction data for a specific liquidity pool, including swaps, adds, and removes, to analyze trading activity and liquidity changes.
Instructions
Get recent transactions for a specific pool. Shows swaps, adds, removes. Requires network and pool address.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | Yes | Network ID from getNetworks (e.g., "ethereum", "solana") | |
| poolAddress | Yes | Pool address or identifier | |
| page | No | Page number for pagination (up to 100 pages) | |
| limit | No | Number of items per page (max 100) | |
| cursor | No | Transaction ID used for cursor-based pagination |
Implementation Reference
- src/index.js:228-235 (handler)The handler function that constructs the DexPaprika API endpoint for retrieving transactions of a specific pool and fetches/formats the response.async ({ network, poolAddress, page, limit, cursor }) => { let endpoint = `/networks/${network}/pools/${poolAddress}/transactions?page=${page}&limit=${limit}`; if (cursor) { endpoint += `&cursor=${encodeURIComponent(cursor)}`; } const data = await fetchFromAPI(endpoint); return formatMcpResponse(data); }
- src/index.js:221-227 (schema)Zod input schema defining parameters for the getPoolTransactions tool: network, poolAddress, page, limit, cursor.{ network: z.string().describe('Network ID from getNetworks (e.g., "ethereum", "solana")'), poolAddress: z.string().describe('Pool address or identifier'), page: z.number().optional().default(0).describe('Page number for pagination (up to 100 pages)'), limit: z.number().optional().default(10).describe('Number of items per page (max 100)'), cursor: z.string().optional().describe('Transaction ID used for cursor-based pagination') },
- src/index.js:218-236 (registration)Registration of the getPoolTransactions tool via server.tool(), including name, description, schema, and handler function.server.tool( 'getPoolTransactions', 'Get recent transactions for a specific pool. Shows swaps, adds, removes. Requires network and pool address.', { network: z.string().describe('Network ID from getNetworks (e.g., "ethereum", "solana")'), poolAddress: z.string().describe('Pool address or identifier'), page: z.number().optional().default(0).describe('Page number for pagination (up to 100 pages)'), limit: z.number().optional().default(10).describe('Number of items per page (max 100)'), cursor: z.string().optional().describe('Transaction ID used for cursor-based pagination') }, async ({ network, poolAddress, page, limit, cursor }) => { let endpoint = `/networks/${network}/pools/${poolAddress}/transactions?page=${page}&limit=${limit}`; if (cursor) { endpoint += `&cursor=${encodeURIComponent(cursor)}`; } const data = await fetchFromAPI(endpoint); return formatMcpResponse(data); } );
- src/index.js:10-34 (helper)Shared helper function to fetch data from the DexPaprika API, handling errors like rate limits and deprecated endpoints.async function fetchFromAPI(endpoint) { try { const response = await fetch(`${API_BASE_URL}${endpoint}`); if (!response.ok) { if (response.status === 410) { throw new Error( 'This endpoint has been permanently removed. Please use network-specific endpoints instead. ' + 'For example, use /networks/{network}/pools instead of /pools. ' + 'Get available networks first using the getNetworks function.' ); } if (response.status === 429) { throw new Error( 'Rate limit exceeded. You have reached the maximum number of requests allowed for the free tier. ' + 'To increase your rate limits and access additional features, please consider upgrading to a paid plan at https://docs.dexpaprika.com/' ); } throw new Error(`API request failed with status ${response.status}`); } return await response.json(); } catch (error) { console.error(`Error fetching from API: ${error.message}`); throw error; } }
- src/index.js:37-46 (helper)Shared helper to format the API response into MCP-compatible content structure.function formatMcpResponse(data) { return { content: [ { type: "text", text: JSON.stringify(data) } ] }; }