search_addresses_llm
Search Ethereum blockchain addresses using natural language queries powered by LLaMA 3.2 3B AI to intelligently analyze 150+ address parameters and return relevant results.
Instructions
LLM-powered address search using LLaMA 3.2 3B to intelligently select from 150+ parameters
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Natural language query for address search |
Implementation Reference
- index.js:108-121 (schema)Input schema definition and description for the 'search_addresses_llm' tool, registered in the listTools response.{ name: 'search_addresses_llm', description: 'LLM-powered address search using LLaMA 3.2 3B to intelligently select from 150+ parameters', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Natural language query for address search', }, }, required: ['query'], }, },
- index.js:693-695 (handler)Handler implementation for 'search_addresses_llm' tool. Forwards the tool arguments to the ChainFETCH API endpoint '/api/v1/ethereum/addresses/llm_search' via a GET request.case 'search_addresses_llm': return await this.makeRequest('/api/v1/ethereum/addresses/llm_search', 'GET', args, null, token);
- index.js:634-682 (helper)Helper method 'makeRequest' that performs authenticated HTTP requests to the ChainFETCH API, used by the search_addresses_llm handler and other tools.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(); }
- index.js:612-631 (handler)MCP CallToolRequest handler that dispatches to specific tool handlers via handleToolCall based on tool name.this.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const result = await this.handleToolCall(name, args, this.currentToken); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Tool execution failed: ${error.message}` ); } });
- index.js:684-781 (handler)Central dispatch function handleToolCall that routes tool calls to specific API endpoints via switch on tool name, including search_addresses_llm.async handleToolCall(name, args, token = null) { switch (name) { // Address endpoints case 'search_addresses_semantic': return await this.makeRequest('/api/v1/ethereum/addresses/semantic_search', 'GET', args, null, token); case 'search_addresses_json': return await this.makeRequest('/api/v1/ethereum/addresses/json_search', 'GET', args, null, token); case 'search_addresses_llm': return await this.makeRequest('/api/v1/ethereum/addresses/llm_search', 'GET', args, null, token); case 'get_address_summary': return await this.makeRequest('/api/v1/ethereum/addresses/summary', 'GET', args, null, token); case 'get_address_info': const { address } = args; return await this.makeRequest(`/api/v1/ethereum/addresses/${address}`, 'GET', {}, null, token); // Transaction endpoints case 'search_transactions_semantic': return await this.makeRequest('/api/v1/ethereum/transactions/semantic_search', 'GET', args, null, token); case 'search_transactions_json': return await this.makeRequest('/api/v1/ethereum/transactions/json_search', 'GET', args, null, token); case 'search_transactions_llm': return await this.makeRequest('/api/v1/ethereum/transactions/llm_search', 'GET', args, null, token); case 'get_transaction_summary': return await this.makeRequest('/api/v1/ethereum/transactions/summary', 'GET', args, null, token); case 'get_transaction_info': const { transaction } = args; return await this.makeRequest(`/api/v1/ethereum/transactions/${transaction}`, 'GET', {}, null, token); // Block endpoints case 'search_blocks_semantic': return await this.makeRequest('/api/v1/ethereum/blocks/semantic_search', 'GET', args, null, token); case 'search_blocks_json': return await this.makeRequest('/api/v1/ethereum/blocks/json_search', 'GET', args, null, token); case 'search_blocks_llm': return await this.makeRequest('/api/v1/ethereum/blocks/llm_search', 'GET', args, null, token); case 'get_block_summary': return await this.makeRequest('/api/v1/ethereum/blocks/summary', 'GET', args, null, token); case 'get_block_info': const { block } = args; return await this.makeRequest(`/api/v1/ethereum/blocks/${block}`, 'GET', {}, null, token); // Token endpoints case 'search_tokens_semantic': return await this.makeRequest('/api/v1/ethereum/tokens/semantic_search', 'GET', args, null, token); case 'search_tokens_json': return await this.makeRequest('/api/v1/ethereum/tokens/json_search', 'GET', args, null, token); case 'search_tokens_llm': return await this.makeRequest('/api/v1/ethereum/tokens/llm_search', 'GET', args, null, token); case 'get_token_summary': return await this.makeRequest('/api/v1/ethereum/tokens/summary', 'GET', args, null, token); case 'get_token_info': const { token: tokenAddress } = args; return await this.makeRequest(`/api/v1/ethereum/tokens/${tokenAddress}`, 'GET', {}, null, token); case 'get_nft_instance_info': const { token: nftToken, instance_id } = args; return await this.makeRequest(`/api/v1/ethereum/token-instances/${nftToken}/${instance_id}`, 'GET', {}, null, token); // Smart Contract endpoints case 'search_smart_contracts_semantic': return await this.makeRequest('/api/v1/ethereum/smart-contracts/semantic_search', 'GET', args, null, token); case 'search_smart_contracts_json': return await this.makeRequest('/api/v1/ethereum/smart-contracts/json_search', 'GET', args, null, token); case 'search_smart_contracts_llm': return await this.makeRequest('/api/v1/ethereum/smart-contracts/llm_search', 'GET', args, null, token); case 'get_smart_contract_summary': return await this.makeRequest('/api/v1/ethereum/smart-contracts/summary', 'GET', args, null, token); case 'get_smart_contract_info': const { address: contractAddress } = args; return await this.makeRequest(`/api/v1/ethereum/smart-contracts/${contractAddress}`, 'GET', {}, null, token); default: throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${name}` ); } }