Skip to main content
Glama
chainfetch

ChainFETCH MCP Server

Official
by chainfetch

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
NameRequiredDescriptionDefault
nameNoToken name
symbolNoToken symbol
addressNoToken contract address
typeNoToken type (ERC-20, ERC-721, ERC-1155)
holders_count_minNoMinimum holder count
holders_count_maxNoMaximum holder count
limitNoNumber of results to return (default: 10, max: 50)
offsetNoNumber 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: [], }, },
  • 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);
  • 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: [], },
  • 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(); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chainfetch/chainfetch-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server