search_pools
Find DeFi liquidity pools by searching with pool addresses, token addresses, or token symbols across multiple blockchain networks.
Instructions
Search for pools by query (pool address, token address, or token symbol)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (pool address, token address, or token symbol) | |
| network | No | Network ID to search on (optional, e.g., 'eth', 'bsc', 'polygon_pos') | |
| include | No | Attributes to include: 'base_token', 'quote_token', 'dex' (comma-separated) | |
| page | No | Page number for pagination (optional, default: 1) |
Implementation Reference
- src/index.js:405-433 (schema)MCP tool schema definition for 'search_pools' including input schema with required 'query' parameter{ name: TOOL_NAMES.SEARCH_POOLS, description: "Search for pools by query (pool address, token address, or token symbol)", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query (pool address, token address, or token symbol)", }, network: { type: "string", description: "Network ID to search on (optional, e.g., 'eth', 'bsc', 'polygon_pos')", }, include: { type: "string", description: "Attributes to include: 'base_token', 'quote_token', 'dex' (comma-separated)", }, page: { type: "integer", description: "Page number for pagination (optional, default: 1)", }, }, required: ["query"], },
- src/index.js:1064-1070 (registration)Tool dispatcher registration in MCP CallToolRequestHandler switch statement, calling toolService.searchPoolscase TOOL_NAMES.SEARCH_POOLS: result = await toolService.searchPools(args.query, { network: args.network, include: args.include, page: args.page, }); break;
- src/toolService.js:260-274 (handler)Main handler function for search_pools tool that validates input, delegates to CoinGecko API service, and formats responseasync searchPools(query, options = {}) { if (!query) { throw new Error("query is required"); } const result = await this.coinGeckoApi.searchPools(query, options); return { message: `Pool search for "${query}" completed successfully`, data: result, summary: `Found ${result.data?.length || 0} pools matching "${query}"${ options.network ? ` on ${options.network}` : "" }`, }; }
- Core implementation that makes HTTP request to CoinGecko /onchain/search/pools endpointasync searchPools(query, options = {}) { try { const queryParams = new URLSearchParams(); if (query) queryParams.append('query', query); if (options.network) queryParams.append('network', options.network); if (options.include) queryParams.append('include', options.include); if (options.page) queryParams.append('page', options.page); const url = `${this.baseUrl}/search/pools${queryParams.toString() ? '?' + queryParams.toString() : ''}`; const response = await fetch(url, { headers: { 'x-cg-demo-api-key': this.apiKey } }); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); } return await response.json(); } catch (error) { throw new Error(`Failed to search pools: ${error.message}`); } }
- src/constants.js:27-27 (registration)TOOL_NAMES constant defining the tool name 'search_pools' used in schema and dispatcherSEARCH_POOLS: "search_pools",