get_block_details
Retrieve detailed blockchain block information, including optional transaction data, to analyze network activity and verify transactions across supported networks.
Instructions
Get detailed block information with optional transaction list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockchain | Yes | Blockchain name | |
| blockNumber | Yes | Block number (number or "latest", "earliest", "pending") | |
| includeTransactions | No | Include full transaction objects (default: false) | |
| network | No | Network type (defaults to mainnet) |
Implementation Reference
- MCP tool handler for get_block_details: extracts arguments, performs safety check for large responses, calls service, and formats response.case 'get_block_details': { const blockchain = args?.blockchain as string; const blockNumber = args?.blockNumber as string | number; const includeTransactions = (args?.includeTransactions as boolean) || false; const network = (args?.network as 'mainnet' | 'testnet') || 'mainnet'; // SAFETY CHECK: Block queries with full transactions const safetyCheck = checkBlockQuery( 'eth_getBlockByNumber', [blockNumber, includeTransactions] ); if (!safetyCheck.safe) { return { content: [ { type: 'text', text: `⛔ UNSAFE BLOCK QUERY BLOCKED\n\n` + `Reason: ${safetyCheck.reason}\n\n` + `Suggestion: ${safetyCheck.suggestion}\n\n` + `This protection prevents session crashes from large responses.`, }, ], isError: true, }; } const result = await advancedBlockchain.getBlockDetails( blockchain, blockNumber, includeTransactions, network ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
- Input schema and tool metadata definition for get_block_details tool.{ name: 'get_block_details', description: 'Get detailed block information with optional transaction list', inputSchema: { type: 'object', properties: { blockchain: { type: 'string', description: 'Blockchain name', }, blockNumber: { description: 'Block number (number or "latest", "earliest", "pending")', }, includeTransactions: { type: 'boolean', description: 'Include full transaction objects (default: false)', }, network: { type: 'string', enum: ['mainnet', 'testnet'], description: 'Network type (defaults to mainnet)', }, }, required: ['blockchain', 'blockNumber'], }, },
- Core implementation: retrieves blockchain service and calls eth_getBlockByNumber RPC method with proper block parameter formatting.async getBlockDetails( blockchain: string, blockNumber: string | number, includeTransactions: boolean = false, 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})`, }; } const blockParam = typeof blockNumber === 'number' ? '0x' + blockNumber.toString(16) : blockNumber; return this.blockchainService.callRPCMethod( service.id, 'eth_getBlockByNumber', [blockParam, includeTransactions] ); }