get-native-currency-balance
Retrieve the native cryptocurrency balance for any blockchain address. This tool queries on-chain data to display current holdings without requiring 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: casts address, calls wagmi's getBalance with wagmiConfig and address, stringifies the result with JSONStringify, and returns it as text content.execute: async (args) => { const address = args.address as Address const result = await getBalance(wagmiConfig, { address }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } },
- Zod input schema requiring a single 'address' string parameter.parameters: z.object({ address: z.string() }),
- packages/metamask-mcp/src/tools/get-balance.ts:9-27 (registration)Registers the 'get-native-currency-balance' tool on the FastMCP server within registerGetBalanceTools function.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)Top-level call to registerGetBalanceTools during server initialization, which includes the get-native-currency-balance tool.registerGetBalanceTools(server);