Skip to main content
Glama

wallet_get_balance

Retrieve the balance of an Ethereum or EVM-compatible wallet using a private key, mnemonic, or JSON. Optionally, specify a block tag to query the balance at a specific point in time.

Instructions

Get the balance of the wallet

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockTagNoOptional block tag (latest, pending, etc.)
walletNoThe wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set.

Implementation Reference

  • The main handler function for wallet_get_balance tool. It gets the wallet instance, calls getBalance on it with optional blockTag, formats the result, and returns a success or error response.
    export const getBalanceHandler = async (input: any): Promise<ToolResultSchema> => {
      try {
        const wallet = await getWallet(input.wallet, input.password);
    
        const balance = await wallet.getBalance(input.blockTag ?? "latest");
    
        return createSuccessResponse(
          `Wallet balance retrieved successfully
          Balance: ${balance.toString()}
          Balance in ETH: ${ethers.utils.formatEther(balance)}
        `);
      } catch (error) {
        return createErrorResponse(`Failed to get wallet balance: ${(error as Error).message}`);
      }
    };
  • The input schema definition for the wallet_get_balance tool, including name, description, and inputSchema properties.
    {
      name: "wallet_get_balance",
      description: "Get the balance of the wallet",
      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:572-572 (registration)
    The registration entry in the handlers dictionary that maps 'wallet_get_balance' to the getBalanceHandler function.
    "wallet_get_balance": getBalanceHandler,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states it 'gets' balance, implying a read-only operation, but doesn't disclose behavioral traits like whether it requires authentication, network connectivity, rate limits, error conditions, or what happens when parameters are omitted. The description is minimal and lacks essential operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 6 words, front-loading the core purpose with zero wasted language. Every word earns its place by directly communicating the tool's function without redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is insufficiently complete. It doesn't explain what format the balance returns in (e.g., Wei, Ether, token-specific units), whether it's for native currency or tokens, or any error handling. For a financial tool with potential complexity, this minimal description leaves critical gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (blockTag and wallet). The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in description, which applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('balance of the wallet'), making the purpose immediately understandable. It distinguishes from siblings like wallet_get_address or wallet_get_transaction_count by focusing specifically on balance retrieval. However, it doesn't explicitly differentiate from network-related tools, though the 'wallet_' prefix provides some context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While the name suggests it's for balance queries, there's no mention of when to choose this over other wallet tools or network tools for similar purposes. No prerequisites, exclusions, or alternative tools are referenced.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/dcSpark/mcp-cryptowallet-evm'

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