Skip to main content
Glama

resolveName

Resolve ENS names to Ethereum addresses using the MCP Ethers Wallet server. Specify the ENS name and optionally the network or chain ID for accurate resolution across Ethereum networks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainIdNoOptional. The chain ID to use. If provided with a named network and they don't match, the RPC's chain ID will be used.
nameYesThe ENS name to resolve
providerNoOptional. Either a network name or custom RPC URL. Use getAllNetworks to see available networks and their details, or getNetwork to get info about a specific network. You can use any network name returned by these tools as a provider value.

Implementation Reference

  • Executes the resolveName tool logic: gets an ethers provider based on provider/chainId, calls provider.resolveName(name) to resolve ENS name to Ethereum address, returns structured JSON response with success/failure.
    async ({ name, provider, chainId }) => { try { const ethProvider = await ethersService.getProvider(provider, chainId); // Resolve the ENS name to an address const address = await ethProvider.resolveName(name); if (!address) { return { content: [{ type: "text", text: JSON.stringify({ name, resolved: false, message: "Name could not be resolved" }, null, 2) }] }; } return { content: [{ type: "text", text: JSON.stringify({ name, address, resolved: true }, null, 2) }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error resolving ENS name: ${error instanceof Error ? error.message : String(error)}` }] }; } } );
  • Zod schema for input parameters of resolveName tool: name (string, required), provider (string, optional), chainId (number, optional).
    { name: z.string().describe( "The ENS name to resolve" ), provider: z.string().optional().describe(PROVIDER_DESCRIPTION), chainId: z.number().optional().describe( "Optional. The chain ID to use. If provided with a named network and they don't match, the RPC's chain ID will be used." ) },
  • Direct registration of the resolveName tool using server.tool() within registerCoreTools function, including inline schema and handler.
    // ENS resolveName tool server.tool( "resolveName", { name: z.string().describe( "The ENS name to resolve" ), provider: z.string().optional().describe(PROVIDER_DESCRIPTION), chainId: z.number().optional().describe( "Optional. The chain ID to use. If provided with a named network and they don't match, the RPC's chain ID will be used." ) }, async ({ name, provider, chainId }) => { try { const ethProvider = await ethersService.getProvider(provider, chainId); // Resolve the ENS name to an address const address = await ethProvider.resolveName(name); if (!address) { return { content: [{ type: "text", text: JSON.stringify({ name, resolved: false, message: "Name could not be resolved" }, null, 2) }] }; } return { content: [{ type: "text", text: JSON.stringify({ name, address, resolved: true }, null, 2) }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error resolving ENS name: ${error instanceof Error ? error.message : String(error)}` }] }; } } );
  • Top-level registration call to registerCoreTools in registerAllTools, which registers the resolveName tool among core tools.
    registerCoreTools(server, ethersService);

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

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