Skip to main content
Glama

get_pusd_balance

Retrieve PUSD token balance information for a specified blockchain chain ID. Returns JSON data showing current balance on supported EVM chains.

Instructions

Get PUSD token balance on specified chain.

Args:
    chain_id: Chain ID (1, 10, 56, 100, 137, 8453, 42161)

Returns:
    JSON string with PUSD balance information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYes

Implementation Reference

  • The handler function that implements the get_pusd_balance tool. It retrieves the PUSD token balance for the server's account on the specified EVM chain by querying the ERC20 contract using Web3.py.
    async def get_pusd_balance(ctx: Context, chain_id: str) -> str:
        """Get PUSD token balance on specified chain.
        
        Args:
            chain_id: Chain ID (1, 10, 56, 100, 137, 8453, 42161)
        
        Returns:
            JSON string with PUSD balance information.
        """
        try:
            paloma_ctx = ctx.request_context.lifespan_context
            
            if chain_id not in CHAIN_CONFIGS:
                return f"Error: Unsupported chain ID {chain_id}"
            
            config = CHAIN_CONFIGS[chain_id]
            if not config.pusd_token:
                return f"Error: PUSD token address not configured for {config.name}"
            
            if chain_id not in paloma_ctx.web3_clients:
                return f"Error: Web3 client not available for {config.name}"
            
            web3 = paloma_ctx.web3_clients[chain_id]
            pusd_contract = web3.eth.contract(
                address=config.pusd_token,
                abi=ERC20_ABI
            )
            
            balance_wei = pusd_contract.functions.balanceOf(paloma_ctx.address).call()
            decimals = pusd_contract.functions.decimals().call()
            balance = balance_wei / (10 ** decimals)
            
            balance_info = {
                "chain": config.name,
                "chain_id": config.chain_id,
                "token_address": config.pusd_token,
                "balance": str(balance),
                "symbol": "PUSD",
                "decimals": decimals
            }
            
            return json.dumps(balance_info, indent=2)
            
        except Exception as e:
            logger.error(f"Error getting PUSD balance: {e}")
            return f"Error getting PUSD balance: {str(e)}"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions the return format ('JSON string with PUSD balance information') but lacks details on permissions, rate limits, error handling, or whether this is a read-only operation. For a tool with no annotation coverage, this is insufficient behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and concise, with no wasted words. It front-loads the purpose, then clearly lists arguments and returns in separate sections, making it easy to parse. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no nested objects) and lack of annotations/output schema, the description is adequate but has gaps. It covers the parameter semantics well but misses usage guidelines and behavioral details like authentication or error responses, making it minimally viable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds significant value beyond the input schema, which has 0% description coverage. It explains 'chain_id' as 'Chain ID' and provides a list of valid values (1, 10, 56, 100, 137, 8453, 42161), which compensates for the schema's lack of documentation. With only one parameter, this is effectively complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get PUSD token balance on specified chain.' It uses a specific verb ('Get') and identifies the resource ('PUSD token balance'), but doesn't differentiate from similar sibling tools like 'get_address_balance_single_chain' or 'get_etf_balance' beyond mentioning the specific token (PUSD).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention sibling tools like 'get_address_balance_single_chain' (which might handle multiple tokens) or 'get_etf_balance' (for ETF tokens), nor does it specify prerequisites such as authentication or account context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/VolumeFi/mcpPADEX'

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