search_tokens_json
Search for Ethereum tokens using JSON parameters including name, symbol, address, type, and holder count filters to find specific tokens in blockchain data.
Instructions
JSON search for tokens with comprehensive search parameters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Token name | |
| symbol | No | Token symbol | |
| address | No | Token contract address | |
| type | No | Token type (ERC-20, ERC-721, ERC-1155) | |
| holders_count_min | No | Minimum holder count | |
| holders_count_max | No | Maximum holder count | |
| limit | No | Number of results to return (default: 10, max: 50) | |
| offset | No | Number of results to skip for pagination (default: 0) |
Implementation Reference
- index.js:402-445 (registration)Registration of the search_tokens_json tool in the ListTools response, defining its name, description, and input schema with parameters for token name, symbol, address, type, holder counts, limit, and offset.{ name: 'search_tokens_json', description: 'JSON search for tokens with comprehensive search parameters', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Token name', }, symbol: { type: 'string', description: 'Token symbol', }, address: { type: 'string', description: 'Token contract address', }, type: { type: 'string', description: 'Token type (ERC-20, ERC-721, ERC-1155)', }, holders_count_min: { type: 'integer', description: 'Minimum holder count', }, holders_count_max: { type: 'integer', description: 'Maximum holder count', }, limit: { type: 'integer', description: 'Number of results to return (default: 10, max: 50)', default: 10, }, offset: { type: 'integer', description: 'Number of results to skip for pagination (default: 0)', default: 0, }, }, required: [], }, },
- index.js:741-742 (handler)Handler implementation for the search_tokens_json tool. Forwards the tool arguments to the ChainFetch API endpoint /api/v1/ethereum/tokens/json_search using a GET request.case 'search_tokens_json': return await this.makeRequest('/api/v1/ethereum/tokens/json_search', 'GET', args, null, token);
- index.js:405-444 (schema)Input schema definition for the search_tokens_json tool, specifying the structure and types for query parameters.inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Token name', }, symbol: { type: 'string', description: 'Token symbol', }, address: { type: 'string', description: 'Token contract address', }, type: { type: 'string', description: 'Token type (ERC-20, ERC-721, ERC-1155)', }, holders_count_min: { type: 'integer', description: 'Minimum holder count', }, holders_count_max: { type: 'integer', description: 'Maximum holder count', }, limit: { type: 'integer', description: 'Number of results to return (default: 10, max: 50)', default: 10, }, offset: { type: 'integer', description: 'Number of results to skip for pagination (default: 0)', default: 0, }, }, required: [], },
- index.js:634-682 (helper)Helper function makeRequest used by all tool handlers to make authenticated HTTP requests to the ChainFetch API, handling query parameters, authentication, and error handling.async makeRequest(endpoint, method = 'GET', params = {}, body = null, token = null) { const chainfetchToken = token || process.env.CHAINFETCH_API_TOKEN; if (!chainfetchToken) { throw new McpError( ErrorCode.InvalidRequest, 'CHAINFETCH_API_TOKEN is required' ); } const url = new URL(`${API_BASE_URL}${endpoint}`); // Add query parameters for GET requests if (method === 'GET' && Object.keys(params).length > 0) { Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { if (Array.isArray(value)) { value.forEach(v => url.searchParams.append(`${key}[]`, v)); } else { url.searchParams.append(key, value.toString()); } } }); } const fetchOptions = { method, headers: { 'Authorization': `Bearer ${chainfetchToken}`, 'Content-Type': 'application/json', }, }; if (body && method !== 'GET') { fetchOptions.body = JSON.stringify(body); } const response = await fetch(url.toString(), fetchOptions); if (!response.ok) { const errorText = await response.text(); throw new McpError( ErrorCode.InternalError, `API request failed: ${response.status} ${response.statusText} - ${errorText}` ); } return await response.json(); }