Skip to main content
Glama
fakepixels

Base Network MCP Server

by fakepixels

check_balance

Verify wallet balances on the Base network using the MCP server by providing the wallet name or address. Simplifies blockchain operations through natural language commands.

Instructions

Check wallet balance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletNoWallet name or address (defaults to primary wallet)

Implementation Reference

  • The core handler function that implements the check_balance tool logic: retrieves the balance of a specified wallet (defaulting to the primary wallet) using getWalletBalance and returns a formatted response.
    async function handleCheckBalance(args: CheckBalanceArgs): Promise<any> {
      try {
        const walletName = args.wallet || (getDefaultWallet()?.name || 'default');
        const balance = await getWalletBalance(walletName);
        
        return {
          success: true,
          message: `Balance of wallet "${walletName}": ${balance} ETH`,
          balance,
          wallet: walletName
        };
      } catch (error) {
        console.error('Error checking balance:', error);
        throw error;
      }
    }
  • MCP server registration of the check_balance tool in the standard ListToolsRequestSchema handler, defining name, description, and input schema.
    {
      name: 'check_balance',
      description: 'Check wallet balance',
      inputSchema: {
        type: 'object',
        properties: {
          wallet: {
            type: 'string',
            description: 'Wallet name or address (defaults to primary wallet)',
          },
        },
      },
    },
  • TypeScript interface defining the input parameters for the check_balance tool.
    export interface CheckBalanceArgs {
      wallet?: string; // Wallet name or address, defaults to primary wallet
      asset?: string; // Asset type, defaults to ETH
    }
  • Additional registration of the check_balance tool in the custom listTools method handler.
    {
      name: 'check_balance',
      description: 'Check wallet balance',
      inputSchema: {
        type: 'object',
        properties: {
          wallet: {
            type: 'string',
            description: 'Wallet name or address (defaults to primary wallet)',
          },
        },
      },
    },
  • Dispatch handler in the MCP server's CallToolRequestSchema that invokes the check_balance tool handler with validated arguments and formats the response.
    case 'check_balance': {
      const result = await toolHandlers.handleCheckBalance({
        wallet: typeof args.wallet === 'string' ? args.wallet : undefined,
      });
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Check wallet balance' implies a read-only operation, but it doesn't specify whether this requires authentication, what happens if the wallet doesn't exist, or if there are rate limits. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 three words ('Check wallet balance'), with zero wasted language. It's front-loaded and efficiently communicates the core purpose without unnecessary details. This is an example of optimal brevity for a simple tool.

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 the tool's simplicity (one optional parameter, no output schema, no annotations), the description is incomplete. It doesn't address what the tool returns (e.g., balance amount, currency), error conditions, or behavioral aspects like authentication needs. For even a simple tool, more context would be helpful for an AI agent.

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?

The input schema has 100% description coverage, with the 'wallet' parameter documented as 'Wallet name or address (defaults to primary wallet)'. The description adds no additional meaning beyond this, as it doesn't mention parameters at all. With high schema coverage, the baseline score of 3 is appropriate, as the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Check wallet balance' clearly states the verb ('Check') and resource ('wallet balance'), but it's somewhat vague about what specifically is being checked. It doesn't distinguish this tool from potential alternatives like 'get_balance' or 'view_balance', though no direct siblings exist with similar names. The purpose is understandable but lacks specificity.

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 there are sibling tools like 'create_wallet' and 'list_wallets', the description doesn't mention them or explain scenarios where checking balance is appropriate versus creating or listing wallets. It's a basic statement with no contextual usage information.

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/fakepixels/base-mcp-server'

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