network_get_block_number
Retrieve the current block number from the Ethereum or EVM-compatible blockchain for accurate synchronization and transaction tracking in wallet operations.
Instructions
Get the current block number
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "network_get_block_number"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/handlers/wallet.ts:729-744 (handler)The handler function getBlockNumberHandler that executes the tool logic: retrieves the Ethereum provider and calls getBlockNumber() to return the current block number.
export const getBlockNumberHandler = async (input: any): Promise<ToolResultSchema> => { try { const provider = getProvider(); if (!provider) { return createErrorResponse("Provider is required to get block number, please set the provider URL"); } const blockNumber = await provider.getBlockNumber(); return createSuccessResponse( `Block number retrieved successfully Block number: ${blockNumber.toString()} `); } catch (error) { return createErrorResponse(`Failed to get block number: ${(error as Error).message}`); } }; - src/tools.ts:534-542 (schema)Tool schema definition including name, description, and input schema (no parameters required).
{ name: "network_get_block_number", description: "Get the current block number", inputSchema: { type: "object", properties: {}, required: [] } }, - src/tools.ts:602-604 (registration)Registration of the network_get_block_number tool handler in the handlers dictionary, mapping the tool name to getBlockNumberHandler.
"network_get_network": getNetworkHandler, "network_get_block_number": getBlockNumberHandler, "network_get_fee_data": getFeeDataHandler, - src/tools.ts:1-36 (registration)Import statement that brings in the getBlockNumberHandler from the handlers/wallet.ts file.
import { createWalletHandler, fromPrivateKeyHandler, fromMnemonicHandler, fromEncryptedJsonHandler, encryptWalletHandler, getAddressHandler, getPublicKeyHandler, getPrivateKeyHandler, getBalanceHandler, getChainIdHandler, getGasPriceHandler, getTransactionCountHandler, callHandler, sendTransactionHandler, signTransactionHandler, populateTransactionHandler, signMessageHandler, signTypedDataHandler, verifyMessageHandler, verifyTypedDataHandler, getBlockHandler, getTransactionHandler, getTransactionReceiptHandler, getCodeHandler, getStorageAtHandler, estimateGasHandler, getLogsHandler, getEnsResolverHandler, lookupAddressHandler, resolveNameHandler, getNetworkHandler, getBlockNumberHandler, getFeeDataHandler, createMnemonicPhraseHandler, setProviderHandler