Skip to main content
Glama
dewanshparashar

Arbitrum MCP Server

get_balance

Check the wei balance of any Ethereum address on Arbitrum networks using RPC endpoints for monitoring and interaction.

Instructions

Get balance of an address in wei

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rpcUrlNoThe RPC URL of the chain (optional if default is set)
addressYesEthereum address to check balance for

Implementation Reference

  • MCP tool handler for 'get_balance': resolves RPC URL using chainName/rpcUrl, creates EthereumAccountClient instance, calls getBalance(address), formats and returns balance in wei as text content.
    case "get_balance": {
      const rpcUrl = await this.resolveRpcUrl(
        (args.rpcUrl as string) || (args.chainName as string)
      );
      const ethereumAccountClient = new EthereumAccountClient(rpcUrl);
      const balance = await ethereumAccountClient.getBalance(
        args.address as string
      );
      return {
        content: [
          {
            type: "text",
            text: `Balance: ${balance} wei`,
          },
        ],
      };
    }
  • src/index.ts:944-960 (registration)
    Tool registration definition in getAvailableTools(): specifies name, description, and inputSchema for the 'get_balance' tool.
    name: "get_balance",
    description: "Get balance of an address in wei",
    inputSchema: {
      type: "object" as const,
      properties: {
        rpcUrl: {
          type: "string",
          description:
            "The RPC URL of the chain (optional if default is set)",
        },
        address: {
          type: "string",
          description: "Ethereum address to check balance for",
        },
      },
      required: ["address"],
    },
  • Helper function EthereumAccountClient.getBalance(): performs the 'eth_getBalance' RPC call with address and 'latest' block tag, returns raw balance in wei.
    async getBalance(address: string): Promise<string> {
      const balance = await this.makeRpcCall('eth_getBalance', [address, 'latest']);
      return balance;
    }
  • Related helper EthereumAccountClient.getBalanceInEther(): converts wei balance to ETH with decimal handling (used by separate get_balance_ether tool).
    async getBalanceInEther(address: string): Promise<string> {
      const weiBalance = await this.getBalance(address);
      const wei = BigInt(weiBalance);
      const ether = wei / BigInt('1000000000000000000');
      const remainder = wei % BigInt('1000000000000000000');
      
      if (remainder === BigInt(0)) {
        return ether.toString();
      } else {
        const etherDecimal = Number(wei) / 1e18;
        return etherDecimal.toFixed(6).replace(/\.?0+$/, '');
      }
    }
  • Underlying makeRpcCall method: handles all RPC calls to the provider, used by getBalance.
    private async makeRpcCall(method: string, params: any[]): Promise<any> {
      try {
        const requestBody = {
          jsonrpc: '2.0',
          id: Date.now(),
          method,
          params,
        };
    
        console.error(`Making RPC call to ${this.rpcUrl}: ${method}`);
        
        const response = await fetch(this.rpcUrl, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
          body: JSON.stringify(requestBody),
        });
    
        if (!response.ok) {
          throw new Error(`HTTP ${response.status}: ${response.statusText}`);
        }
    
        const data = await response.json();
        
        if (data.error) {
          throw new Error(`RPC Error: ${data.error.message}`);
        }
    
        return data.result;
      } catch (error) {
        console.error(`RPC call failed for ${method} on ${this.rpcUrl}:`, error);
        if (error instanceof Error) {
          throw error;
        } else {
          throw new Error(`Unknown error during RPC call: ${String(error)}`);
        }
      }
    }
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 what the tool does but doesn't disclose behavioral traits like whether it's read-only, potential rate limits, error conditions, authentication needs, or what happens with invalid addresses. For a tool with zero annotation coverage, this is a significant gap in behavioral disclosure.

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?

Extremely concise single sentence with zero waste. Every word earns its place: verb ('Get'), resource ('balance'), target ('of an address'), and unit specification ('in wei'). Front-loaded with the core purpose immediately clear.

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?

For a tool with no annotations, no output schema, and 2 parameters, the description is insufficient. It doesn't explain what the return value looks like (balance as number/string, error formats), doesn't mention the blockchain context implied by 'wei', and provides no behavioral context. The 100% schema coverage helps with parameters but doesn't compensate for other 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 already documents both parameters thoroughly. The description doesn't add any parameter semantics beyond what's in the schema - it mentions 'address' but doesn't provide additional context about format validation or the rpcUrl parameter. Baseline 3 is appropriate when schema does the heavy lifting.

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 action ('Get balance') and resource ('of an address'), specifying the unit ('in wei'). It distinguishes from sibling 'get_balance_ether' by specifying wei vs ether units. However, it doesn't explicitly mention the blockchain context or differentiate from other balance-checking tools beyond the unit.

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?

No guidance on when to use this tool versus alternatives like 'get_balance_ether' or other sibling tools. The description mentions 'wei' which implies a unit difference from 'get_balance_ether', but doesn't explicitly state when to choose one over the other or provide any context about prerequisites or typical use cases.

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

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/dewanshparashar/arbitrum-mcp'

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