search_pools
Find DeFi pools by searching with a pool address, token address, or token symbol. Specify network, attributes, and pagination for precise results on supported blockchains.
Instructions
Search for pools by query (pool address, token address, or token symbol)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include | No | Attributes to include: 'base_token', 'quote_token', 'dex' (comma-separated) | |
| network | No | Network ID to search on (optional, e.g., 'eth', 'bsc', 'polygon_pos') | |
| page | No | Page number for pagination (optional, default: 1) | |
| query | Yes | Search query (pool address, token address, or token symbol) |
Implementation Reference
- src/index.js:405-434 (schema)MCP tool schema definition including input schema, description, and name for search_pools{ 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 execution handler dispatch in MCP callToolRequest that routes search_pools calls to toolServicecase 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)Primary handler function in ToolService that validates input, calls CoinGecko API, and formats response for search_pools toolasync 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}` : "" }`, }; }
- Supporting utility in CoinGeckoApiService that performs the actual HTTP API call to CoinGecko's 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)Constant definition for the tool name used in registration and dispatchSEARCH_POOLS: "search_pools",