Skip to main content
Glama

get-name-history

Retrieve the full history of an Ethereum Name Service (ENS) domain, including ownership changes and record updates, by querying the ENS system.

Instructions

Get the history of an ENS name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe ENS name to check history for

Implementation Reference

  • Implements the core logic of the 'get-name-history' tool by fetching and formatting the ENS name's history events using publicClient.getNameHistory.
    export async function getNameHistory( { name }: { name: string }): Promise<ServerResponse> {
        const normalizedName = normalizeName(name);
        try {
            const history = await publicClient.getNameHistory({ name: normalizedName });
    
            if (!history) {
                return {
                    content: [{ type: "text", text: `No history found for ${name}` }],
                    isError: false
                };
            }
    
            let output = `History for ${name}:\n\n`;
    
            if (history.domainEvents.length > 0) {
                output += "Domain Events:\n";
                for (const event of history.domainEvents) {
                    output += `- ${event.type} at block ${event.blockNumber}\n`;
    
                    
                    if (event.type === 'Transfer' || event.type === 'NewOwner') {
                        output += `  New owner: ${event.owner}\n`;
                    } else if (event.type === 'NewResolver') {
                        output += `  New resolver: ${event.resolver}\n`;
                    }
                }
            }
    
            if (history.registrationEvents && history.registrationEvents.length > 0) {
                output += "\nRegistration Events:\n";
                for (const event of history.registrationEvents) {
                    output += `- ${event.type} at block ${event.blockNumber}\n`;
    
                    
                    if (event.type === 'NameRegistered') {
                        output += `  Registrant: ${event.registrant}\n`;
                        output += `  Expiry Date: ${new Date(Number(event.expiryDate) * 1000).toLocaleString()}\n`;
                    } else if (event.type === 'NameRenewed') {
                        output += `  New Expiry Date: ${new Date(Number(event.expiryDate) * 1000).toLocaleString()}\n`;
                    }
                }
            }
    
            if (history.resolverEvents && history.resolverEvents.length > 0) {
                output += "\nResolver Events:\n";
                for (const event of history.resolverEvents) {
                    output += `- ${event.type} at block ${event.blockNumber}\n`;
    
                    
                    if (event.type === 'AddrChanged') {
                        output += `  New address: ${event.addr}\n`;
                    } else if (event.type === 'TextChanged') {
                        output += `  Key: ${event.key}\n`;
                        if (event.value) output += `  Value: ${event.value}\n`;
                    }
                }
            }
    
            return {
                content: [{ type: "text", text: output }],
                isError: false
            };
        } catch (error) {
            const errorMessage = handleEnsError(error, "get name history");
    
            return {
                content: [{ type: "text", text: errorMessage }],
                isError: true
            };
        }
    }
  • index.ts:89-96 (registration)
    Registers the 'get-name-history' MCP tool with input schema and delegates to the getNameHistory handler.
    server.tool(
        "get-name-history",
        "Get the history of an ENS name",
        {
            name: z.string().describe("The ENS name to check history for"),
        },
        async (params) => getNameHistory( params)
    );
  • Defines the output schema structure used by the getNameHistory handler and other tools.
    interface ServerResponse {
        content: TextContent[];
        isError: boolean;
        _meta?: { [key: string]: unknown };
        [x: string]: unknown;
    }
  • Helper function to normalize ENS names by appending '.eth' if missing, used in getNameHistory.
    const normalizeName = (name: string) => name.endsWith('.eth') ? name : `${name}.eth`;
  • Helper function for error handling in ENS operations, used in getNameHistory.
    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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves history but doesn't specify what 'history' entails (e.g., ownership changes, transaction logs, registration events), whether it requires authentication, rate limits, or the format of the returned data. This leaves significant gaps for an agent to understand the tool's 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, clear sentence with no wasted words. It is front-loaded with the core purpose, making it easy to parse quickly. Every part of the sentence contributes directly to understanding the tool's function.

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 complexity of historical data retrieval and the lack of annotations and output schema, the description is insufficient. It doesn't explain what type of history is returned, potential errors, or how to interpret results. For a tool that likely involves nuanced data, more context is needed to guide an agent effectively.

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' clearly documented as 'The ENS name to check history for'. The description adds no additional meaning beyond this, as it doesn't elaborate on the format of the ENS name or provide examples. Given the high schema coverage, a baseline score of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the action ('Get the history') and the resource ('of an ENS name'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its siblings like 'get-all-records' or 'resolve-name', which might also involve historical or record-related queries about ENS names.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'get-all-records' and 'resolve-name', there's no indication of whether this tool is for transaction history, ownership changes, or other types of historical data, leaving the agent to guess based on the name alone.

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