arb_get_raw_block_metadata
Retrieve raw block metadata for specified block ranges on Arbitrum chains using admin API, enabling detailed chain monitoring and analysis.
Instructions
Retrieve raw block metadata for specified block ranges (requires admin API)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainName | No | Chain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL | |
| fromBlock | Yes | Starting block number | |
| rpcUrl | No | The RPC URL of the Arbitrum node (optional if default is set) | |
| toBlock | No | Ending block number (defaults to fromBlock if not provided) |
Implementation Reference
- src/clients/nitro-node-client.ts:172-199 (handler)Core handler function that executes the RPC call to 'arb_getRawBlockMetadata' and processes the response into BlockMetadata arrayasync getRawBlockMetadata( fromBlock: number, toBlock: number ): Promise<BlockMetadata[] | { error: string }> { try { const result = await this.makeRpcCall("arb_getRawBlockMetadata", [ `0x${fromBlock.toString(16)}`, `0x${toBlock.toString(16)}`, ]); if (Array.isArray(result)) { return result.map((item: any) => ({ blockNumber: parseInt(item.blockNumber, 16), metadata: item.metadata || item.rawMetadata, })); } return { error: "Unexpected response format from arb_getRawBlockMetadata", }; } catch (error) { return { error: `Raw block metadata not supported on this RPC endpoint: ${ (error as Error).message }`, }; } }
- src/index.ts:428-447 (handler)MCP server request handler that resolves the RPC URL or chain name and delegates to NitroNodeClient.getRawBlockMetadatacase "arb_get_raw_block_metadata": { const rpcUrl = await this.resolveRpcUrl( (args.rpcUrl as string) || (args.chainName as string) ); const nodeClient = new NitroNodeClient(rpcUrl); const fromBlock = (args.fromBlock as number) || 0; const toBlock = (args.toBlock as number) || fromBlock; const metadata = await nodeClient.getRawBlockMetadata( fromBlock, toBlock ); return { content: [ { type: "text", text: JSON.stringify(metadata, null, 2), }, ], }; }
- src/index.ts:1120-1148 (registration)Tool registration in the list of available tools, including name, description, and input schema definitionname: "arb_get_raw_block_metadata", description: "Retrieve raw block metadata for specified block ranges (requires admin API)", inputSchema: { type: "object" as const, properties: { rpcUrl: { type: "string", description: "The RPC URL of the Arbitrum node (optional if default is set)", }, chainName: { type: "string", description: "Chain name (e.g., 'Xai', 'Arbitrum One') - will auto-resolve to RPC URL", }, fromBlock: { type: "number", description: "Starting block number", }, toBlock: { type: "number", description: "Ending block number (defaults to fromBlock if not provided)", }, }, required: ["fromBlock"], }, },
- TypeScript interface defining the structure of individual block metadata returned by the handlerexport interface BlockMetadata { blockNumber: number; metadata: string; // Raw metadata bytes as hex string }