Skip to main content
Glama

get-text-record

Retrieve specific text records associated with an Ethereum Name Service (ENS) domain, such as email, URL, avatar, or social media details, by specifying the domain name and record key.

Instructions

Get a text record for an ENS name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe record key to look up (e.g., 'email', 'url', 'avatar', 'description', 'twitter', etc.)
nameYesThe ENS name to query

Implementation Reference

  • The handler function that executes the tool logic: normalizes the ENS name, fetches the text record via publicClient, handles no-value and error cases, returning a formatted ServerResponse.
    export async function getTextRecord( { name, key }: { name: string, key: string }): Promise<ServerResponse> {
        const normalizedName = normalizeName(name);
        try {
            const value = await publicClient.getTextRecord({ name:normalizedName, key });
    
            if (!value) {
                return {
                    content: [{ type: "text", text: `No '${key}' record found for ${normalizedName}` }],
                    isError: false
                };
            }
    
            return {
                content: [{ type: "text", text: `The '${key}' record for ${normalizedName} is: ${value}` }],
                isError: false
            };
        } catch (error) {
            const errorMessage = handleEnsError(error, "getting records");
    
            return {
                content: [{ type: "text", text: errorMessage }],
                isError: true
            };
        }
    }
  • index.ts:48-56 (registration)
    Registers the get-text-record tool with the MCP server, including input schema and handler invocation.
    server.tool(
        "get-text-record",
        "Get a text record for an ENS name",
        {
            name: z.string().describe("The ENS name to query"),
            key: z.string().describe("The record key to look up (e.g., 'email', 'url', 'avatar', 'description', 'twitter', etc.)"),
        },
        async (params) => getTextRecord( params)
    );
  • Zod schema defining input parameters: name (ENS name) and key (text record key).
    {
        name: z.string().describe("The ENS name to query"),
        key: z.string().describe("The record key to look up (e.g., 'email', 'url', 'avatar', 'description', 'twitter', etc.)"),
    },
  • Helper function to normalize ENS names by appending '.eth' if missing.
    const normalizeName = (name: string) => name.endsWith('.eth') ? name : `${name}.eth`;
  • Helper for standardized error handling in ENS operations, used in the handler.
    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 full burden for behavioral disclosure. It states the tool 'gets' a text record, implying a read-only operation, but doesn't specify whether it requires authentication, has rate limits, returns errors for non-existent records, or provides any context about the ENS system. 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, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse 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 doesn't explain what a 'text record' entails in the ENS context, what format the return value might have, or any error conditions. For a tool interacting with a specialized system like ENS, more context is needed for effective 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 input schema has 100% description coverage, clearly documenting both required parameters ('name' and 'key') with examples for 'key'. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline for high schema coverage.

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') and resource ('text record for an ENS name'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'get-all-records' or 'resolve-name', which might also retrieve ENS-related data.

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 like 'get-all-records' (which might retrieve multiple records) or 'resolve-name' (which might resolve to an address). There's no mention of specific use cases, prerequisites, or exclusions.

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