Skip to main content
Glama

getTransactionCount

Retrieve the total number of transactions sent from a specific Ethereum wallet address to analyze account activity and usage patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes

Implementation Reference

  • The handler function that executes the getTransactionCount tool logic. It takes an Ethereum address, fetches the transaction count (nonce) using web3.eth.getTransactionCount, and returns a formatted text response or error.
    async ({ address }) => { try { const transactionCount = await web3.eth.getTransactionCount(address); return { content: [{ type: "text", text: `Transaction count (nonce) for ${address}: ${transactionCount}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error fetching transaction count: ${error.message}` }] }; } }
  • Zod schema defining the input parameter: an Ethereum address validated with regex.
    { address: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address") },
  • tools/balance.js:29-43 (registration)
    The server.tool call that registers the getTransactionCount tool with the MCP server, specifying the name, input schema, and handler function.
    server.tool("getTransactionCount", { address: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address") }, async ({ address }) => { try { const transactionCount = await web3.eth.getTransactionCount(address); return { content: [{ type: "text", text: `Transaction count (nonce) for ${address}: ${transactionCount}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error fetching transaction count: ${error.message}` }] }; } } );
  • main.js:60-60 (registration)
    Invocation of registerBalanceTools which includes the registration of getTransactionCount among other balance tools.
    registerBalanceTools(server, web3);

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/0xGval/evm-mcp-tools'

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