get_wallet_token_balance
Retrieve cryptocurrency token balances for multiple wallet addresses and tokens simultaneously to monitor portfolio holdings across different assets.
Instructions
Get the balance for a list of wallet/token pairs.
Expects a WalletTokenPairsContainer, returns a list of WalletTokenBalance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet_token_pairs | Yes |
Implementation Reference
- armor_crypto_mcp/armor_mcp.py:112-126 (handler)MCP tool registration and handler for 'get_wallet_token_balance', which proxies the request to the ArmorWalletAPIClient instance.@mcp.tool() async def get_wallet_token_balance(wallet_token_pairs: WalletTokenPairsContainer) -> List[WalletTokenBalance]: """ Get the balance for a list of wallet/token pairs. Expects a WalletTokenPairsContainer, returns a list of WalletTokenBalance. """ if not armor_client: return [{"error": "Not logged in"}] try: result: List[WalletTokenBalance] = await armor_client.get_wallet_token_balance(wallet_token_pairs) return result except Exception as e: return [{"error": str(e)}]
- Core implementation in ArmorWalletAPIClient that serializes the input container and makes the HTTP POST request to the Armor API endpoint '/tokens/wallet-token-balance/'.async def get_wallet_token_balance(self, data: WalletTokenPairsContainer) -> List[WalletTokenBalance]: """Get balances from a list of wallet and token pairs.""" # payload = [v.model_dump() for v in data.wallet_token_pairs] payload = data.model_dump(exclude_none=True)['wallet_token_pairs'] return await self._api_call("POST", "tokens/wallet-token-balance/", payload)
- Pydantic container model for the tool input, holding a list of WalletTokenPairs.class WalletTokenPairsContainer(BaseModel): wallet_token_pairs: List[WalletTokenPairs]
- Pydantic model defining each wallet-token pair in the input.class WalletTokenPairs(BaseModel): wallet: str = Field(description="The name of wallet. To get wallet names use `get_user_wallets_and_groups_list`") token: str = Field(description="public address of token. To get the address from a token symbol use `get_token_details`")
- Pydantic model for the output balance response items.class WalletTokenBalance(BaseModel): wallet: str = Field(description="name of wallet") token: str = Field(description="public address of token") balance: float = Field(description="balance of token")