Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
walletAddressYesWallet address to check

Implementation Reference

  • 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;
      }
    }
  • 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),
          },
        ],
      };
    }

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/SailFish-Finance/educhain-ai-agent-kit'

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