search_logs
Search blockchain event logs by address and topics across multiple networks to analyze smart contract interactions and transaction patterns.
Instructions
Search event logs by address and topics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| filter | Yes | Log filter with fromBlock, toBlock, address, topics | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- Core handler implementation for search_logs: calls eth_getLogs RPC on the blockchain service with the provided filter.async searchLogs( blockchain: string, filter: { fromBlock?: string; toBlock?: string; address?: string | string[]; topics?: (string | string[] | null)[]; }, network: 'mainnet' | 'testnet' = 'mainnet' ): Promise<EndpointResponse> { const service = this.blockchainService.getServiceByBlockchain(blockchain, network); if (!service) { return { success: false, error: `Blockchain service not found: ${blockchain} (${network})`, }; } return this.blockchainService.callRPCMethod( service.id, 'eth_getLogs', [filter] ); }
- MCP tool handler case for 'search_logs' in handleTransactionTool: extracts parameters and delegates to AdvancedBlockchainService.searchLogs.case 'search_logs': { const blockchain = args?.blockchain as string; const filter = args?.filter as any; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; const result = await advancedBlockchain.searchLogs(blockchain, filter, network); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Input schema definition for the search_logs tool, specifying parameters blockchain, filter, and network.{ name: 'search_logs', description: 'Search event logs by address and topics', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, filter: { type: 'object', description: 'Log filter with fromBlock, toBlock, address, topics', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'filter'], }, },
- src/handlers/transaction-handlers.ts:134-136 (registration)The tools array in registerTransactionHandlers includes search_logs for registration with the MCP server.return tools; }