Skip to main content
Glama

get_supported_chains

Fetch a Markdown table detailing blockchain networks supported by the Blocknative Gas Platform, including chain ID, system, and network information.

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 tool. It is registered via @mcp.tool() decorator and implements the logic to fetch and format supported chains into a Markdown table.
    @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
  • Supporting helper utility that performs the HTTP request to Blocknative API to retrieve the list of supported chains.
    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)}"}
  • The @mcp.tool() decorator registers the get_supported_chains function as an MCP tool.
    @mcp.tool()

Other Tools

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

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