Skip to main content
Glama

get_supported_chains

Retrieve a formatted list of blockchain networks supported by the Blocknative Gas Platform, including chain ID, system, and network details.

Instructions

List the blockchain networks supported by the Blocknative Gas Platform, formatted as a Markdown table. Parameters: - ctx (Optional[Context]): The MCP context object. Default: None. Returns: - A Markdown table listing supported chains with their chain ID, system, and network.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ctxNo

Implementation Reference

  • The handler function for the 'get_supported_chains' MCP tool, including the @mcp.tool() decorator for registration. It calls the fetch_supported_chains helper and formats the response as a Markdown table listing supported blockchain networks.
    @mcp.tool() async def get_supported_chains(ctx: Optional[Context] = None) -> str: """ List the blockchain networks supported by the Blocknative Gas Platform, formatted as a Markdown table. Parameters: - ctx (Optional[Context]): The MCP context object. Default: None. Returns: - A Markdown table listing supported chains with their chain ID, system, and network. """ data = await fetch_supported_chains() if data["error"]: return data["error"] chains = data["chains"] if not chains: return "No supported chains found." output = "Supported Chains:\n\n" output += "| Chain ID | System | Network |\n" output += "|----------|--------|---------|\n" for chain in chains: chain_id = chain.get("chainId", "Unknown") system = chain.get("system", "Unknown") network = chain.get("network", "Unknown") output += f"| {chain_id} | {system} | {network} |\n" return output
  • Helper utility function that fetches the list of supported chains from the Blocknative API endpoint.
    # Helper function to fetch supported chains from Blocknative async def fetch_supported_chains() -> Dict: """Fetch the list of supported chains from Blocknative Chains API.""" try: headers = {"Authorization": BLOCKNATIVE_API_KEY} if BLOCKNATIVE_API_KEY else {} async with httpx.AsyncClient() as client: response = await client.get(BLOCKNATIVE_CHAINS_API_URL, headers=headers) response.raise_for_status() data = response.json() return {"chains": data, "error": None} except httpx.HTTPError as e: return {"chains": [], "error": f"Failed to fetch supported chains: {str(e)}"}

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/kukapay/blocknative-mcp'

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