pool_spot_prices
Retrieve real-time token pair prices from Uniswap V2/V3 and compatible DEX liquidity pools by specifying blockchain network and pool contract address.
Instructions
Get the spot token pair prices for a specified pool contract address. Supports pools on Uniswap V2, V3 and their forks. Required: chainName (blockchain network), contractAddress (pool contract address). Optional: quoteCurrency (price currency) for value conversion. Returns spot token pair prices with pool details and token metadata.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainName | Yes | The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet'). | |
| contractAddress | Yes | The liquidity pool contract address to get spot prices for. Must be a valid Uniswap V2/V3 or compatible DEX pool address. | |
| quoteCurrency | No | Currency to quote pool token values in (e.g., 'USD', 'EUR'). If not specified, uses default quote currency. |
Implementation Reference
- src/services/PricingService.ts:97-146 (handler)The `pool_spot_prices` tool registration and handler implementation. It uses `zod` for input validation and `goldRushClient.PricingService.getPoolSpotPrices` to fetch the data.
server.tool( "pool_spot_prices", "Get the spot token pair prices for a specified pool contract address. Supports pools on Uniswap V2, V3 and their forks.\n" + "Required: chainName (blockchain network), contractAddress (pool contract address).\n" + "Optional: quoteCurrency (price currency) for value conversion.\n" + "Returns spot token pair prices with pool details and token metadata.", { chainName: z .enum(Object.values(ChainName) as [string, ...string[]]) .describe( "The blockchain network to query (e.g., 'eth-mainnet', 'matic-mainnet', 'bsc-mainnet')." ), contractAddress: z .string() .describe( "The liquidity pool contract address to get spot prices for. Must be a valid Uniswap V2/V3 or compatible DEX pool address." ), quoteCurrency: z .enum(Object.values(validQuoteValues) as [string, ...string[]]) .optional() .describe( "Currency to quote pool token values in (e.g., 'USD', 'EUR'). If not specified, uses default quote currency." ), }, async (params) => { try { const response = await goldRushClient.PricingService.getPoolSpotPrices( params.chainName as Chain, params.contractAddress, { quoteCurrency: params.quoteCurrency as Quote, } ); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } } );