Skip to main content
Glama

get-native-currency-balance

Retrieve the native currency balance of a specified blockchain address using MCPilot's secure MetaMask integration, enabling AI-driven blockchain interactions without exposing private keys.

Instructions

Get the native currency balance of an address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYes

Implementation Reference

  • The handler function that executes the tool by fetching the native currency balance of the given address using wagmi's getBalance and wagmiConfig, then stringifying the result.
    execute: async (args) => { const address = args.address as Address const result = await getBalance(wagmiConfig, { address }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } },
  • Zod schema defining the input parameters: an 'address' string.
    parameters: z.object({ address: z.string() }),
  • The server.addTool call that registers the 'get-native-currency-balance' tool, including name, description, parameters, and execute handler.
    server.addTool({ name: "get-native-currency-balance", description: "Get the native currency balance of an address", parameters: z.object({ address: z.string() }), execute: async (args) => { const address = args.address as Address const result = await getBalance(wagmiConfig, { address }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } }, });
  • The call to registerGetBalanceTools(server) which in turn registers the balance tools including 'get-native-currency-balance'.
    registerGetBalanceTools(server);

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/mcpilot'

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