Skip to main content
Glama

get_etf_price

Retrieve current buy and sell prices for ETF tokens on Paloma DEX across multiple EVM chains to inform trading decisions.

Instructions

Get buy and sell prices for an ETF token.

Args:
    chain_id: Chain ID (1, 10, 56, 100, 137, 8453, 42161)
    etf_token_address: Address of the ETF token

Returns:
    JSON string with buy and sell prices for the ETF token.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYes
etf_token_addressYes

Implementation Reference

  • The core handler implementation for the 'get_etf_price' MCP tool. This async function fetches real-time ETF buy/sell prices from the Paloma DEX API endpoint using the provided chain ID and EVM ETF token address. It includes input validation, API call via httpx, and JSON response formatting. The @mcp.tool() decorator handles automatic registration and schema generation.
    @mcp.tool()
    async def get_etf_price(ctx: Context, chain_id: str, etf_token_address: str) -> str:
        """Get buy and sell prices for an ETF token.
        
        Args:
            chain_id: Chain ID (1, 10, 56, 100, 137, 8453, 42161)
            etf_token_address: Address of the ETF token
        
        Returns:
            JSON string with buy and sell prices for the ETF token.
        """
        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]
            
            # Validate ETF token address
            if not Web3.is_address(etf_token_address):
                return f"Error: Invalid ETF token address format: {etf_token_address}"
            
            chain_name = get_chain_name_for_api(chain_id)
            if not chain_name:
                return f"Error: Chain name mapping not found for chain ID {chain_id}"
            
            # Call Paloma DEX API to get custom pricing
            api_url = f"https://api.palomadex.com/etfapi/v1/customindexprice?chain_id={chain_name}&token_evm_address={etf_token_address}"
            
            response = await paloma_ctx.http_client.get(api_url)
            if response.status_code == 200:
                price_data = response.json()
                
                result = {
                    "chain": config.name,
                    "chain_id": config.chain_id,
                    "etf_token_address": etf_token_address,
                    "pricing": price_data,
                    "timestamp": asyncio.get_event_loop().time()
                }
                
                return json.dumps(result, indent=2)
            else:
                return f"Error: Failed to fetch ETF price. Status: {response.status_code}"
                    
        except Exception as e:
            logger.error(f"Error getting ETF price: {e}")
            return f"Error getting ETF price: {str(e)}"
  • Helper function used by get_etf_price to map EVM chain IDs to Paloma API chain names (e.g., '1' -> 'ethereum') for constructing the correct API URL.
    def get_chain_name_for_api(chain_id: str) -> Optional[str]:
        """Map chain ID to chain name for Paloma DEX API calls."""
        chain_name_mapping = {
            "1": "ethereum",
            "10": "optimism", 
            "56": "bsc",
            "100": "gnosis",
            "137": "polygon",
            "8453": "base",
            "42161": "arbitrum"
        }
        return chain_name_mapping.get(chain_id)
  • ERC-20 ABI snippet for ETF Connector contract, relevant for ETF trading operations referenced in chain configurations used by get_etf_price context.
    ETF_CONNECTOR_ABI = [
        {
            "name": "buy",
            "type": "function",
            "inputs": [
                {"name": "etf_token", "type": "address"},
                {"name": "etf_amount", "type": "uint256"},
                {"name": "usd_amount", "type": "uint256"},
                {"name": "recipient", "type": "address"},
                {"name": "path", "type": "bytes"},
                {"name": "deadline", "type": "uint256"}
            ],
            "outputs": [],
            "stateMutability": "payable"
        },
        {
            "name": "sell",
            "type": "function",
            "inputs": [
                {"name": "etf_token", "type": "address"},
                {"name": "etf_amount", "type": "uint256"},
                {"name": "deadline", "type": "uint256"},
                {"name": "recipient", "type": "address"}
            ],
            "outputs": [],
            "stateMutability": "payable"
        }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does and the return format ('JSON string with buy and sell prices'), but lacks details on permissions, rate limits, error handling, or whether it's a read-only operation. For a financial data tool, this is a significant gap in transparency.

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 front-loaded with the core purpose, followed by clear sections for arguments and returns. Each sentence earns its place by providing essential information without redundancy. The bullet-point style enhances readability while maintaining brevity.

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 moderate complexity (2 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and parameters but lacks behavioral details like error cases or performance expectations. Without annotations or output schema, more context on return structure or usage scenarios would improve completeness.

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 meaningful context beyond the input schema, which has 0% description coverage. It explains that 'chain_id' accepts specific numeric values (1, 10, etc.) and 'etf_token_address' is the address of the ETF token, clarifying their roles. This compensates well for the schema's lack of descriptions, though it doesn't detail format constraints like address validation.

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 buy and sell prices for an ETF token.' It specifies the verb ('Get') and resource ('buy and sell prices for an ETF token'), making the function unambiguous. However, it doesn't explicitly differentiate from siblings like 'get_etf_price_by_paloma_denom' or 'get_etf_price_by_symbol', which appear to serve similar purposes with different inputs.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions the required arguments but doesn't explain why to choose this over siblings like 'get_etf_price_by_symbol' or 'get_token_price_estimate', nor does it specify prerequisites or exclusions. This leaves the agent without context for tool selection.

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