Skip to main content
Glama
chainfetch

ChainFETCH MCP Server

Official
by chainfetch

search_smart_contracts_json

Search smart contracts using JSON parameters to filter by verification status, name, language, proxy type, and optimization settings.

Instructions

JSON search for smart contracts with 50+ parameters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
is_verifiedNoWhether the contract is verified
nameNoContract name
languageNoProgramming language (e.g., "solidity")
proxy_typeNoProxy type (e.g., "eip1967")
optimization_enabledNoWhether optimization is enabled
limitNoNumber of results to return (default: 10, max: 50)
offsetNoNumber of results to skip for pagination (default: 0)

Implementation Reference

  • index.js:526-565 (registration)
    Registration of the 'search_smart_contracts_json' tool in the ListTools response, including name, description, and input schema definition.
    {
      name: 'search_smart_contracts_json',
      description: 'JSON search for smart contracts with 50+ parameters',
      inputSchema: {
        type: 'object',
        properties: {
          is_verified: {
            type: 'boolean',
            description: 'Whether the contract is verified',
          },
          name: {
            type: 'string',
            description: 'Contract name',
          },
          language: {
            type: 'string',
            description: 'Programming language (e.g., "solidity")',
          },
          proxy_type: {
            type: 'string',
            description: 'Proxy type (e.g., "eip1967")',
          },
          optimization_enabled: {
            type: 'boolean',
            description: 'Whether optimization is enabled',
          },
          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 case in handleToolCall method that executes the tool by calling makeRequest to proxy the API call to ChainFETCH's json_search endpoint for smart contracts.
    case 'search_smart_contracts_json':
      return await this.makeRequest('/api/v1/ethereum/smart-contracts/json_search', 'GET', args, null, token);
  • Helper method makeRequest that handles the actual HTTP API calls to ChainFETCH, used by all tool handlers including search_smart_contracts_json.
    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();
    }
Behavior1/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. The description fails to mention that this is a read-only search operation, doesn't specify return format (though 'JSON' in name hints at it), doesn't mention rate limits, authentication requirements, or pagination behavior. The '50+ parameters' claim is factually incorrect given the schema shows only 7 parameters.

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

Conciseness2/5

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

While technically concise (one sentence), the description is under-specified and misleading rather than efficiently informative. The single sentence doesn't earn its place since it provides incorrect information about parameter count and fails to convey essential purpose. This is under-specification masquerading as conciseness.

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

Completeness1/5

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

For a search tool with no annotations and no output schema, the description is completely inadequate. It fails to explain what the tool returns, how results are structured, whether it's paginated, or any behavioral constraints. The misleading parameter count claim further undermines completeness. This leaves the agent with insufficient information to use the tool effectively.

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?

Schema description coverage is 100%, so the schema already fully documents all 7 parameters. The description adds no meaningful parameter information beyond the misleading '50+ parameters' claim. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in description.

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

Purpose2/5

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

The description 'JSON search for smart contracts with 50+ parameters' is tautological - it restates the tool name 'search_smart_contracts_json' and adds a misleading parameter count claim. It doesn't specify what action is performed (e.g., 'search and return smart contracts matching criteria') or distinguish it from sibling tools like search_smart_contracts_llm or search_smart_contracts_semantic.

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

Usage Guidelines1/5

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

No guidance on when to use this tool versus alternatives like search_smart_contracts_llm or search_smart_contracts_semantic. The description provides no context about appropriate use cases, prerequisites, or exclusions. The misleading '50+ parameters' claim could actually misguide usage decisions.

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