Skip to main content
Glama

get-ens-name

Fetch the primary ENS name for any Ethereum address using MetaMask MCP server to interact with blockchain data securely.

Instructions

Fetch the primary ENS name for address.

Input Schema

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

Implementation Reference

  • The async execute function implementing the tool logic: calls wagmi's getEnsName and formats result as MCP text content.
    execute: async (args) => { const result = await getEnsName(wagmiConfig, args); return { content: [ { type: "text", text: result ?? "undefined", }, ], }; },
  • Zod input schema defining parameters: address (required), chainId and 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."), }),
  • Registration function that adds the 'get-ens-name' tool to the FastMCP server including name, description, schema, and handler.
    export function registerGetENSNameTools(server: FastMCP, wagmiConfig: Config): void { 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 the tool registration function within the main registerTools aggregator.
    registerGetENSNameTools(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