wallet_get_transaction_count
Retrieve the total number of transactions sent from your Ethereum or EVM-compatible account, including the nonce, to track transaction history and ensure proper transaction sequencing.
Instructions
Get the number of transactions sent from this account (nonce)
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": "wallet_get_transaction_count"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| blockTag | No | Optional block tag (latest, pending, etc.) | |
| wallet | No | The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set. |
Implementation Reference
- src/handlers/wallet.ts:275-292 (handler)The main handler function that executes the wallet_get_transaction_count tool. It retrieves the wallet instance, checks for a provider, calls wallet.getTransactionCount(blockTag), and returns the result or error.
export const getTransactionCountHandler = async (input: any): Promise<ToolResultSchema> => { try { const wallet = await getWallet(input.wallet, input.password); if (!wallet.provider) { return createErrorResponse("Provider is required to get transaction count, please set the provider URL"); } const transactionCount = await wallet.getTransactionCount(input.blockTag); return createSuccessResponse( `Transaction count retrieved successfully Transaction count: ${transactionCount.toString()} `); } catch (error) { return createErrorResponse(`Failed to get transaction count: ${(error as Error).message}`); } }; - src/tools.ts:210-221 (schema)Defines the tool name, description, and input schema (wallet and optional blockTag) for wallet_get_transaction_count.
{ name: "wallet_get_transaction_count", description: "Get the number of transactions sent from this account (nonce)", inputSchema: { type: "object", properties: { wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }, blockTag: { type: "string", description: "Optional block tag (latest, pending, etc.)" } }, required: [] } }, - src/tools.ts:575-575 (registration)Maps the tool name 'wallet_get_transaction_count' to its handler function getTransactionCountHandler in the central handlers dictionary.
"wallet_get_transaction_count": getTransactionCountHandler, - src/tools.ts:13-13 (registration)Imports the getTransactionCountHandler from './handlers/wallet.js' for use in tools.ts.
getTransactionCountHandler,