Skip to main content
Glama
blockscout

Blockscout MCP Server

Official

get_address_by_ens_name

Convert an ENS domain name to its corresponding Ethereum address using blockchain data from the Blockscout MCP Server. Ideal for resolving domain names to addresses for transactions or analysis.

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 main handler function for the get_address_by_ens_name tool. It resolves the ENS domain to an Ethereum address using the Bens API, reports progress, and returns a structured ToolResponse with EnsAddressData.
    @log_tool_invocation 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)
  • MCP tool registration for get_address_by_ens_name, including annotations and structured_output setting.
    mcp.tool( structured_output=False, annotations=create_tool_annotations("Get Address by ENS Name"), )(get_address_by_ens_name)
  • Pydantic model defining the output data structure for the get_address_by_ens_name tool, used in ToolResponse[EnsAddressData].
    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."), )

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