latest_block
Retrieve the most recent block data from Arbitrum Nitro nodes using a specified RPC URL. Monitor chain activity and health efficiently with this essential tool for developers and node operators.
Instructions
Get the latest block information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rpcUrl | No | The RPC URL of the chain (optional if default is set) |
Implementation Reference
- src/index.ts:928-941 (registration)Tool registration and input schema definition for 'latest_block' in the listTools response{ name: "latest_block", description: "Get the latest block information", inputSchema: { type: "object" as const, properties: { rpcUrl: { type: "string", description: "The RPC URL of the chain (optional if default is set)", }, }, required: [], },
- src/index.ts:218-231 (handler)Main MCP handler for 'latest_block' tool: resolves RPC, instantiates client, calls getLatestBlock, returns JSON responsecase "latest_block": { const rpcUrl = await this.resolveRpcUrl( (args.rpcUrl as string) || (args.chainName as string) ); const chainDataClient = new ArbitrumChainClient(rpcUrl); const latestBlock = await chainDataClient.getLatestBlock(); return { content: [ { type: "text", text: JSON.stringify(latestBlock, null, 2), }, ], };
- Core implementation of latest block retrieval via eth_getBlockByNumber RPC call at 'latest' block with transaction details disabledasync getLatestBlock(): Promise<any> { return await this.makeRpcCall("eth_getBlockByNumber", ["latest", false]); }