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
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes |
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() }),
- packages/metamask-mcp/src/tools/get-balance.ts:9-27 (registration)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), }, ], } }, });
- packages/metamask-mcp/src/index.ts:44-44 (registration)The call to registerGetBalanceTools(server) which in turn registers the balance tools including 'get-native-currency-balance'.registerGetBalanceTools(server);