Skip to main content
Glama
5ajaki

MCP Etherscan Server

by 5ajaki

get-ens-name

Resolve Ethereum addresses to their ENS names using Etherscan's API. Input an address in 0x format to retrieve the associated ENS domain name.

Instructions

Get the ENS name for an Ethereum address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesEthereum address (0x format)

Implementation Reference

  • Executes the 'get-ens-name' tool by validating the input address with AddressSchema, calling EtherscanService.getENSName, and formatting the response as text.
    if (name === "get-ens-name") {
      try {
        const { address } = AddressSchema.parse(args);
        const ensName = await etherscanService.getENSName(address);
        const response = ensName
          ? `ENS name for ${address}: ${ensName}`
          : `No ENS name found for ${address}`;
        return {
          content: [{ type: "text", text: response }],
        };
      } catch (error) {
        if (error instanceof z.ZodError) {
          throw new Error(
            `Invalid input: ${error.errors.map((e) => e.message).join(", ")}`
          );
        }
        throw error;
      }
    }
  • Zod schema used to validate the 'address' input parameter for the get-ens-name tool (and others).
    const AddressSchema = z.object({
      address: z
        .string()
        .regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format"),
    });
  • src/server.ts:146-160 (registration)
    Registers the 'get-ens-name' tool in the ListTools response, including its description and input schema.
    {
      name: "get-ens-name",
      description: "Get the ENS name for an Ethereum address",
      inputSchema: {
        type: "object",
        properties: {
          address: {
            type: "string",
            description: "Ethereum address (0x format)",
            pattern: "^0x[a-fA-F0-9]{40}$",
          },
        },
        required: ["address"],
      },
    },
  • Core implementation that resolves the Ethereum address to its ENS name using ethers.EtherscanProvider.lookupAddress.
    async getENSName(address: string): Promise<string | null> {
      try {
        const validAddress = ethers.getAddress(address);
        return await this.provider.lookupAddress(validAddress);
      } catch (error) {
        if (error instanceof Error) {
          throw new Error(`Failed to get ENS name: ${error.message}`);
        }
        throw error;
      }
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries full burden but only states a read operation. It does not disclose potential failures (e.g., whether it returns null for addresses without ENS names), network dependencies, or any side effects. Minimal behavioral context beyond the obvious.

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 sentence that conveys the core action and object. Every word is functional; there is no fluff or redundancy. It is optimally concise for the tool's simplicity.

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

Completeness3/5

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

Given the tool's simplicity (one parameter, no output schema, no annotations), the description covers the essential purpose but omits details about the return value format, potential errors, or whether it resolves primary ENS names. It is minimally adequate but leaves gaps for an agent unfamiliar with ENS.

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?

Schema coverage is 100% as the single parameter 'address' has a description, pattern, and type. The description adds no extra meaning beyond restating the parameter's purpose ('for an Ethereum address'). It does not provide examples or clarify format nuances beyond the schema.

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 uses a specific verb ('Get') and resource ('ENS name') combined with a clear target ('Ethereum address'). It clearly distinguishes from sibling tools which deal with balances, ABIs, gas, transfers, and transactions, leaving no ambiguity about the tool's function.

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. There is no mention of prerequisites, exclusions, or context where this tool is preferred, leaving the agent to infer usage solely from the name and siblings.

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