Skip to main content
Glama

get_etf_tokens

Retrieve available ETF tokens and their details for a specific blockchain chain ID to support cross-chain trading decisions on Paloma DEX.

Instructions

Get available ETF tokens on a specific chain.

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

Returns:
    JSON string with available ETF tokens and their information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYes

Implementation Reference

  • The handler function decorated with @mcp.tool() that implements the get_etf_tokens tool. It fetches ETF token data from the PalomaDEX API for the specified chain, filters and enriches the data, and returns a formatted JSON response.
    async def get_etf_tokens(ctx: Context, chain_id: str) -> str:
        """Get available ETF tokens on a specific chain.
        
        Args:
            chain_id: Chain ID (1, 10, 56, 100, 137, 8453, 42161)
        
        Returns:
            JSON string with available ETF tokens and their 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]
            
            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 ETF tokens
            api_url = f"https://api.palomadex.com/etfapi/v1/etf?chain_id={chain_name}"
            
            response = await paloma_ctx.http_client.get(api_url)
            if response.status_code == 200:
                etf_data = response.json()
                
                # Filter to only show ETF tokens that have EVM deployments
                deployed_etfs = []
                for etf in etf_data:
                    if etf.get("evm") and len(etf["evm"]) > 0:
                        # Has EVM deployments
                        deployed_etfs.append(etf)
                    else:
                        # No EVM deployment yet - only exists on Paloma
                        etf["status"] = "paloma_only"
                        etf["note"] = "ETF exists on Paloma but not yet deployed to EVM chains"
                        deployed_etfs.append(etf)
                
                result = {
                    "chain": config.name,
                    "chain_id": config.chain_id,
                    "etf_connector": config.etf_connector or "Not configured",
                    "total_etfs": len(etf_data),
                    "evm_deployed_etfs": len([etf for etf in etf_data if etf.get("evm") and len(etf["evm"]) > 0]),
                    "paloma_only_etfs": len([etf for etf in etf_data if not etf.get("evm") or len(etf["evm"]) == 0]),
                    "etf_tokens": deployed_etfs,
                    "trading_note": "ETF trading currently requires EVM token deployment. Most ETFs are Paloma-native only."
                }
                
                return json.dumps(result, indent=2)
            else:
                return f"Error: Failed to fetch ETF tokens. Status: {response.status_code}"
                    
        except Exception as e:
            logger.error(f"Error getting ETF tokens: {e}")
            return f"Error getting ETF tokens: {str(e)}"
  • Helper function used by get_etf_tokens to map chain ID to the chain name required by the PalomaDEX API endpoint.
    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)

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