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();
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'comprehensive search parameters' but doesn't describe what the tool actually returns (format, structure, fields), whether it's paginated beyond the limit/offset parameters, rate limits, authentication requirements, or error conditions. This leaves significant behavioral gaps for a search tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core functionality. While it could be more front-loaded with critical information, there's no wasted verbiage or redundancy. Every word serves a purpose in conveying the tool's basic nature.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with 8 parameters and no output schema, the description is insufficient. It doesn't explain what format the JSON results take, what fields are returned, how results are ordered, or what happens when no matches are found. With no annotations and no output schema, users have no visibility into the tool's behavior beyond the input parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'comprehensive search parameters' which aligns with the 8 parameters in the schema, but adds no specific semantic information beyond what's already documented in the schema (which has 100% coverage). The baseline of 3 is appropriate since the schema does the heavy lifting, though the description doesn't compensate with additional context about parameter interactions or search logic.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs 'JSON search for tokens' with 'comprehensive search parameters', which specifies the verb (search), resource (tokens), and format (JSON). However, it doesn't explicitly differentiate from sibling tools like search_tokens_llm or search_tokens_semantic, which appear to be alternative search methods for the same resource.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools for searching tokens (search_tokens_llm, search_tokens_semantic), there's no indication of when JSON search is preferred over LLM or semantic search approaches, nor any mention of prerequisites or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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