get_edu_balance
Retrieve the EDU token balance for a specific wallet address using the 'get_edu_balance' tool from the EDUCHAIN Agent Kit to monitor token holdings.
Instructions
Get the EDU balance of a wallet address
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| walletAddress | Yes | Wallet address to check |
Input Schema (JSON Schema)
{
"properties": {
"walletAddress": {
"description": "Wallet address to check",
"type": "string"
}
},
"required": [
"walletAddress"
],
"type": "object"
}
Implementation Reference
- src/blockchain.ts:71-85 (handler)Core implementation of get_edu_balance tool: fetches the native EDU token balance for the given address using ethers provider.getBalance, formats it to wei string and ETH decimal string.export async function getEduBalance(address: string): Promise<{ balance: string, balanceInEdu: string }> { try { const provider = getProvider(); const balance = await provider.getBalance(address); const balanceInEdu = ethers.formatEther(balance); return { balance: bigIntToString(balance), balanceInEdu }; } catch (error) { console.error('Error fetching EDU balance:', error); throw error; } }
- src/index.ts:300-311 (schema)Input schema and metadata for the get_edu_balance tool, defining the required 'walletAddress' parameter.name: 'get_edu_balance', description: 'Get the EDU balance of a wallet address', inputSchema: { type: 'object', properties: { walletAddress: { type: 'string', description: 'Wallet address to check', }, }, required: ['walletAddress'], },
- src/index.ts:869-884 (registration)MCP tool registration and execution handler: validates input, calls blockchain.getEduBalance, and returns JSON-formatted result.case 'get_edu_balance': { if (!args.walletAddress || typeof args.walletAddress !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Wallet address is required'); } const balance = await blockchain.getEduBalance(args.walletAddress); return { content: [ { type: 'text', text: JSON.stringify(balance, null, 2), }, ], }; }