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
| Name | Required | Description | Default |
|---|---|---|---|
| ctx | No |
Implementation Reference
- src/blocknative_mcp/cli.py:141-169 (handler)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
- src/blocknative_mcp/cli.py:50-61 (helper)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)}"}
- src/blocknative_mcp/cli.py:141-141 (registration)The @mcp.tool() decorator registers the get_supported_chains function as an MCP tool.@mcp.tool()