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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"address": "<address>"
},
"name": "get-native-currency-balance"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Address to get balance for. |
Implementation Reference
- src/tools/get-balance.ts:15-25 (handler)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), }, ], }; }, - src/tools/get-balance.ts:12-14 (schema)Input schema defining the 'address' parameter as an Address type.
parameters: z.object({ address: Address.describe("Address to get balance for."), }), - src/tools/get-balance.ts:9-26 (registration)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), }, ], }; }, }); - src/tools/register-tools.ts:41-41 (registration)Higher-level registration call to registerGetBalanceTools during overall tool setup.
registerGetBalanceTools(server, wagmiConfig);