Skip to main content
Glama

get-native-currency-balance

Retrieve the native cryptocurrency balance for any blockchain address using MetaMask's secure wallet integration.

Instructions

Get the native currency balance of an address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesAddress to get balance for.

Implementation Reference

  • The tool handler function that fetches the native currency balance using wagmi's getBalance and returns the result as a JSON-stringified text content block.
    execute: async (args) => { const result = await getBalance(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; },
  • Input schema defining the 'address' parameter as an Address type.
    parameters: z.object({ address: Address.describe("Address to get balance for."), }),
  • Tool registration via server.addTool call within the registerGetBalanceTools function.
    server.addTool({ name: "get-native-currency-balance", description: "Get the native currency balance of an address.", parameters: z.object({ address: Address.describe("Address to get balance for."), }), execute: async (args) => { const result = await getBalance(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; }, });
  • Higher-level registration call to registerGetBalanceTools during overall tool setup.
    registerGetBalanceTools(server, wagmiConfig);

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/Xiawpohr/metamask-mcp'

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