Skip to main content
Glama

get-ens-name

Retrieve the primary ENS name associated with a specific blockchain address using MetaMask MCP, enabling secure interaction with Ethereum Name Service (ENS) records.

Instructions

Fetch the primary ENS name for address.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesAddress to get the name for.
blockNumberNoBlock number to get name at.
chainIdNoID of chain to use when fetching data.

Implementation Reference

  • The execute function that implements the core logic of the 'get-ens-name' tool by calling wagmi's getEnsName with the provided arguments and returning the result as a text content block.
    execute: async (args) => { const result = await getEnsName(wagmiConfig, args); return { content: [ { type: "text", text: result ?? "undefined", }, ], }; },
  • Zod schema defining the input parameters: address (required), chainId (optional), blockNumber (optional).
    parameters: z.object({ address: Address.describe("Address to get the name for."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), blockNumber: z.coerce.bigint().optional().describe("Block number to get name at."), }),
  • The server.addTool call that registers the 'get-ens-name' tool, including its name, description, parameters schema, and handler.
    server.addTool({ name: "get-ens-name", description: "Fetch the primary ENS name for address.", parameters: z.object({ address: Address.describe("Address to get the name for."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), blockNumber: z.coerce.bigint().optional().describe("Block number to get name at."), }), execute: async (args) => { const result = await getEnsName(wagmiConfig, args); return { content: [ { type: "text", text: result ?? "undefined", }, ], }; }, });
  • Invocation of registerGetENSNameTools as part of the centralized tools registration function.
    registerGetENSNameTools(server, wagmiConfig);
  • src/index.ts:15-15 (registration)
    Top-level call to register all tools, including 'get-ens-name', in the main server setup.
    registerTools(server, wagmiConfig);

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/Xiawpohr/metamask-mcp'

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