Skip to main content
Glama
blockscout

Blockscout MCP Server

Official

get_address_by_ens_name

Convert ENS domain names to Ethereum addresses using blockchain data from the Blockscout MCP Server.

Instructions

Useful for when you need to convert an ENS domain name (e.g. "blockscout.eth") to its corresponding Ethereum address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesENS domain name to resolve

Implementation Reference

  • The core handler function that resolves the ENS domain name to an Ethereum address by querying the bens API, processing the response, and returning a structured ToolResponse with EnsAddressData.
    async def get_address_by_ens_name( name: Annotated[str, Field(description="ENS domain name to resolve")], ctx: Context ) -> ToolResponse[EnsAddressData]: """ Useful for when you need to convert an ENS domain name (e.g. "blockscout.eth") to its corresponding Ethereum address. """ # TODO: add support for other chains api_path = f"/api/v1/1/domains/{name}" # Report start of operation await report_and_log_progress( ctx, progress=0.0, total=1.0, message=f"Resolving ENS name {name}...", ) response_data = await make_bens_request(api_path=api_path) # Report completion await report_and_log_progress( ctx, progress=1.0, total=1.0, message=f"Successfully resolved ENS name {name}.", ) # Only the address hash is added to the response resolved_address_info = response_data.get("resolved_address", {}) address_hash = resolved_address_info.get("hash") if resolved_address_info else None ens_data = EnsAddressData(resolved_address=address_hash) return build_tool_response(data=ens_data)
  • Pydantic model defining the output schema for the resolved ENS address.
    # --- Model for get_address_by_ens_name Data Payload --- class EnsAddressData(BaseModel): """A structured representation of an ENS name resolution.""" resolved_address: str | None = Field( None, description=("The resolved Ethereum address corresponding to the ENS name, or null if not found."), )
  • Registration of the tool in the FastMCP server instance with annotations and structured_output set to False.
    mcp.tool( structured_output=False, annotations=create_tool_annotations("Get Address by ENS Name"), )(get_address_by_ens_name)

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/blockscout/mcp-server'

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