Skip to main content
Glama
fakepixels
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), }, ], }; }

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