get_latest_block
Retrieve the most recent block data for a specified blockchain network using bnbchain-mcp. Set the network or chain ID to fetch details; defaults to BSC mainnet.
Instructions
Get the latest block
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | Network name (e.g. 'bsc', 'opbnb', 'ethereum', 'base', etc.) or chain ID. Supports others main popular networks. Defaults to BSC mainnet. | bsc |
Implementation Reference
- src/evm/services/blocks.ts:38-41 (handler)The handler function that fetches the latest block for the specified network using the viem public client.export async function getLatestBlock(network = "ethereum"): Promise<Block> { const client = getPublicClient(network) return await client.getBlock() }
- src/evm/modules/blocks/tools.ts:50-64 (registration)Registers the MCP tool 'get_latest_block' with input schema and handler wrapper using mcpToolRes.server.tool( "get_latest_block", "Get the latest block", { network: defaultNetworkParam }, async ({ network }) => { try { const block = await services.getLatestBlock(network) return mcpToolRes.success(block) } catch (error) { return mcpToolRes.error(error, "fetching latest block") } } )