search_smart_contracts_llm
Search smart contracts using natural language queries with AI that analyzes 150+ contract parameters to find relevant blockchain data.
Instructions
LLM-powered smart contract search using AI to select from 150+ parameters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language query for smart contract search |
Implementation Reference
- index.js:566-579 (registration)Registration of the 'search_smart_contracts_llm' tool in the listTools response, including name, description, and input schema requiring a 'query' string.{ name: 'search_smart_contracts_llm', description: 'LLM-powered smart contract search using AI to select from 150+ parameters', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Natural language query for smart contract search', }, }, required: ['query'], }, },
- index.js:765-766 (handler)Handler implementation for 'search_smart_contracts_llm' tool, which proxies the request to the ChainFETCH API endpoint '/api/v1/ethereum/smart-contracts/llm_search' using the makeRequest method.case 'search_smart_contracts_llm': return await this.makeRequest('/api/v1/ethereum/smart-contracts/llm_search', 'GET', args, null, token);
- index.js:634-682 (helper)Shared helper method 'makeRequest' used by the tool handler to perform authenticated API calls to ChainFETCH endpoints.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(); }