Skip to main content
Glama

resolve-name

Convert ENS names to Ethereum addresses with the ENS MCP Server, enabling accurate and direct resolution of blockchain identities for decentralized applications and transactions.

Instructions

Resolve an ENS name to an Ethereum address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe ENS name to resolve (e.g., 'vitalik.eth')

Implementation Reference

  • The core handler function that resolves an ENS name to an Ethereum address using publicClient.getAddressRecord({name, coin: 'ETH'}), normalizes the name, handles errors with handleEnsError, and returns a formatted ServerResponse.
    export async function resolveName(
        { name }: { name: string }
    ): Promise<ServerResponse> {
        const normalizedName = normalizeName(name);
        try {
            const result = await publicClient.getAddressRecord({
                name:normalizedName,
                coin: 'ETH'
            });
    
            if (!result) {
                return {
                    content: [{ type: "text", text: `Could not resolve ${normalizedName} to an address.` }],
                    isError: false
                };
            }
    
            return {
                content: [{ type: "text", text: `The address for ${normalizedName} is ${result.value}` }],
                isError: false
            };
        } catch (error) {
            const errorMessage = handleEnsError(error, "name resolution");
    
            return {
                content: [{ type: "text", text: errorMessage }],
                isError: true
            };
        }
    }
  • index.ts:26-35 (registration)
    Registers the 'resolve-name' tool on the MCP server, providing description, input schema (name: string), and handler that calls resolveName.
    server.tool(
        "resolve-name",
        "Resolve an ENS name to an Ethereum address",
        {
            name: z.string().describe("The ENS name to resolve (e.g., 'vitalik.eth')"),
        },
        async (params) => {
            return await resolveName(params);
        }
    );
  • Zod schema for the tool input: a string parameter 'name' for the ENS name.
    {
        name: z.string().describe("The ENS name to resolve (e.g., 'vitalik.eth')"),
    },
  • Helper function to normalize ENS name by appending '.eth' if missing, used in resolveName.
    const normalizeName = (name: string) => name.endsWith('.eth') ? name : `${name}.eth`;
  • Helper function to handle and format ENS-related errors, used in the catch block of resolveName.
    export function handleEnsError(error: unknown, operation: string): string {
        console.error(`Error during ENS ${operation}:`, error);
    
        
        let errorMessage = "";
    
        if (error instanceof Error) {
            errorMessage = error.message;
    
            
            if (
                errorMessage.includes("fetch failed") ||
                errorMessage.includes("timeout") ||
                errorMessage.includes("network") ||
                errorMessage.includes("HTTP request failed")
            ) {
                return `Network error while accessing Ethereum providers. Please check your internet connection or try again later. Technical details: ${errorMessage}`;
            }
    
            
            if (errorMessage.includes("ENS")) {
                return `ENS error: ${errorMessage}`;
            }
    
            
            if (
                errorMessage.includes("invalid") ||
                errorMessage.includes("parameter")
            ) {
                return `Invalid input: ${errorMessage}`;
            }
        }
    
        
        return `Error during ${operation}: ${errorMessage || String(error)}`;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the basic operation but omits critical details such as error handling (e.g., for invalid names), rate limits, authentication requirements, or response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose with zero wasted words. It is front-loaded and appropriately sized for a simple tool, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It covers the basic purpose but fails to address behavioral aspects like error cases or response structure, which are essential for a tool performing a resolution operation. This leaves the agent with insufficient context for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'name' fully documented in the schema (including an example). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 for adequate but not enhanced parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('resolve') and target resource ('ENS name to an Ethereum address'), distinguishing it from siblings like 'reverse-lookup' (which does the opposite) or 'get-name-history' (which provides historical data). It precisely communicates the tool's function without ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for converting ENS names to addresses but provides no explicit guidance on when to use this tool versus alternatives like 'reverse-lookup' (for address-to-name resolution) or 'check-availability' (for name status). It lacks context on prerequisites or exclusions, leaving usage decisions to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/JustaName-id/ens-mcp-server'

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