Skip to main content
Glama

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
NameRequiredDescriptionDefault
networkNoNetwork name (e.g. 'bsc', 'opbnb', 'ethereum', 'base', etc.) or chain ID. Supports others main popular networks. Defaults to BSC mainnet.bsc

Implementation Reference

  • 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() }
  • 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") } } )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bnb-chain/bnbchain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server