Skip to main content
Glama

get_chain_info

Retrieve configuration and status details for specific blockchain networks to support cross-chain trading operations on Paloma DEX.

Instructions

Get detailed information about a specific chain.

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

Returns:
    JSON string with chain configuration and status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYes

Implementation Reference

  • The handler function for the 'get_chain_info' tool. It is decorated with @mcp.tool() for automatic registration in FastMCP. Retrieves chain configuration from CHAIN_CONFIGS, checks Web3 connection status, fetches latest block number, and returns formatted JSON with chain details.
    @mcp.tool()
    async def get_chain_info(ctx: Context, chain_id: str) -> str:
        """Get detailed information about a specific chain.
        
        Args:
            chain_id: Chain ID (1, 10, 56, 100, 137, 8453, 42161)
        
        Returns:
            JSON string with chain configuration and status.
        """
        try:
            paloma_ctx = ctx.request_context.lifespan_context
            
            if chain_id not in CHAIN_CONFIGS:
                available_chains = [str(k) for k in CHAIN_CONFIGS.keys()]
                return f"Error: Unsupported chain ID '{chain_id}'. Available: {available_chains}"
            
            config = CHAIN_CONFIGS[chain_id]
            
            chain_info = {
                "chain_id": config.chain_id,
                "name": config.name,
                "rpc_url": config.rpc_url,
                "explorer_url": config.explorer_url,
                "gas_price_gwei": config.gas_price_gwei,
                "contracts": {
                    "pusd_token": config.pusd_token or "Not configured",
                    "pusd_connector": config.pusd_connector or "Not configured",
                    "etf_connector": config.etf_connector or "Not configured"
                }
            }
            
            # Add connection status
            if chain_id in paloma_ctx.web3_clients:
                try:
                    web3 = paloma_ctx.web3_clients[chain_id]
                    latest_block = web3.eth.get_block('latest')
                    chain_info["status"] = "connected"
                    chain_info["latest_block"] = latest_block.number
                except Exception as e:
                    chain_info["status"] = f"connection_error: {str(e)}"
            else:
                chain_info["status"] = "not_connected"
            
            return json.dumps(chain_info, indent=2)
            
        except Exception as e:
            logger.error(f"Error getting chain info: {e}")
            return f"Error getting chain info: {str(e)}"
  • Global CHAIN_CONFIGS dictionary mapping ChainID enums to ChainConfig dataclasses. Provides RPC URLs, contract addresses (PUSD, connectors), explorer URLs, and gas prices for all 7 supported EVM chains. Directly used by get_chain_info to populate chain_info dict.
    CHAIN_CONFIGS = {
        ChainID.ETHEREUM_MAIN: ChainConfig(
            chain_id=1,
            name="Ethereum",
            rpc_url="https://eth.llamarpc.com",
            pusd_token=os.getenv("PUSD_TOKEN_ETH", ""),
            pusd_connector=os.getenv("PUSD_CONNECTOR_ETH", ""),
            etf_connector=os.getenv("ETF_CONNECTOR_ETH", ""),
            explorer_url="https://etherscan.io",
            gas_price_gwei=30
        ),
        ChainID.ARBITRUM_MAIN: ChainConfig(
            chain_id=42161,
            name="Arbitrum One",
            rpc_url="https://arb1.arbitrum.io/rpc",
            pusd_token=os.getenv("PUSD_TOKEN_ARB", ""),
            pusd_connector=os.getenv("PUSD_CONNECTOR_ARB", ""),
            etf_connector=os.getenv("ETF_CONNECTOR_ARB", ""),
            explorer_url="https://arbiscan.io",
            gas_price_gwei=1
        ),
        ChainID.OPTIMISM_MAIN: ChainConfig(
            chain_id=10,
            name="Optimism",
            rpc_url="https://mainnet.optimism.io",
            pusd_token=os.getenv("PUSD_TOKEN_OP", ""),
            pusd_connector=os.getenv("PUSD_CONNECTOR_OP", ""),
            etf_connector=os.getenv("ETF_CONNECTOR_OP", ""),
            explorer_url="https://optimistic.etherscan.io",
            gas_price_gwei=1
        ),
        ChainID.BASE_MAIN: ChainConfig(
            chain_id=8453,
            name="Base",
            rpc_url="https://mainnet.base.org",
            pusd_token=os.getenv("PUSD_TOKEN_BASE", ""),
            pusd_connector=os.getenv("PUSD_CONNECTOR_BASE", ""),
            etf_connector=os.getenv("ETF_CONNECTOR_BASE", ""),
            explorer_url="https://basescan.org",
            gas_price_gwei=1
        ),
        ChainID.BSC_MAIN: ChainConfig(
            chain_id=56,
            name="BNB Smart Chain",
            rpc_url="https://bsc-dataseed1.binance.org",
            pusd_token=os.getenv("PUSD_TOKEN_BSC", ""),
            pusd_connector=os.getenv("PUSD_CONNECTOR_BSC", ""),
            etf_connector=os.getenv("ETF_CONNECTOR_BSC", ""),
            explorer_url="https://bscscan.com",
            gas_price_gwei=5
        ),
        ChainID.POLYGON_MAIN: ChainConfig(
            chain_id=137,
            name="Polygon",
            rpc_url="https://polygon-rpc.com",
            pusd_token=os.getenv("PUSD_TOKEN_MATIC", ""),
            pusd_connector=os.getenv("PUSD_CONNECTOR_MATIC", ""),
            etf_connector=os.getenv("ETF_CONNECTOR_MATIC", ""),
            explorer_url="https://polygonscan.com",
            gas_price_gwei=30
        ),
        ChainID.GNOSIS_MAIN: ChainConfig(
            chain_id=100,
            name="Gnosis Chain",
            rpc_url="https://rpc.gnosischain.com",
            pusd_token=os.getenv("PUSD_TOKEN_GNOSIS", ""),
            pusd_connector=os.getenv("PUSD_CONNECTOR_GNOSIS", ""),
            etf_connector=os.getenv("ETF_CONNECTOR_GNOSIS", ""),
            explorer_url="https://gnosisscan.io",
            gas_price_gwei=2
        )
    }
  • Dataclass defining the structure for chain configurations used in CHAIN_CONFIGS and accessed by get_chain_info.
    @dataclass
    class ChainConfig:
        """Configuration for a blockchain network"""
        chain_id: int
        name: str
        rpc_url: str
        pusd_token: str
        pusd_connector: str
        etf_connector: str
        explorer_url: str
        gas_price_gwei: int = 20
  • Enum defining supported chain IDs as strings, used as keys in CHAIN_CONFIGS.
    class ChainID(str, Enum):
        ETHEREUM_MAIN = "1"
        OPTIMISM_MAIN = "10"
        BSC_MAIN = "56"
        POLYGON_MAIN = "137"
        BASE_MAIN = "8453"
        ARBITRUM_MAIN = "42161"
        GNOSIS_MAIN = "100"
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 the tool returns 'JSON string with chain configuration and status,' which gives some output context, but lacks details on permissions, rate limits, error handling, or whether it's a read-only operation. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 'Args' and 'Returns' sections. Every sentence earns its place by directly contributing to understanding the tool's function, parameters, and output, with no wasted words or redundant information.

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 (1 parameter, no nested objects) and lack of output schema, the description is adequate but has gaps. It covers the basic purpose and parameter semantics effectively, but without annotations or output schema, it misses behavioral details like error cases or response structure, making it minimally viable but not fully comprehensive.

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 specifies that 'chain_id' accepts numeric IDs like '1, 10, 56, 100, 137, 8453, 42161,' providing concrete examples that clarify the parameter's expected format and valid values, which compensates well for the schema's lack of documentation.

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 as 'Get detailed information about a specific chain' with a specific verb ('Get') and resource ('chain'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'list_supported_chains' or 'get_account_info', which would require more specific language about what kind of 'detailed information' is provided.

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 doesn't mention sibling tools like 'list_supported_chains' (which might list chains without details) or 'get_account_info' (which might focus on account data rather than chain configuration), leaving the agent to infer usage context without explicit direction.

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