Skip to main content
Glama

get-ens-address

Retrieve Ethereum Name Service (ENS) addresses by providing a name, chain ID, and block number using the MCPilot server, enabling secure blockchain interactions without exposing private keys.

Instructions

Get the ENS address for name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockNumberNo
chainIdNo
nameYes

Implementation Reference

  • The main handler logic that resolves an ENS name to an Ethereum address using wagmi's getEnsAddress function, supporting optional chainId and blockNumber parameters.
    execute: async (args) => { const name = args.name const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const blockNumber = args.blockNumber ? BigInt(args.blockNumber) : undefined const result = await getEnsAddress(wagmiConfig, { name: normalize(name), blockNumber, chainId, }) return { content: [ { type: "text", text: result ?? "undefined", }, ], } },
  • Zod schema for tool inputs: required 'name' (ENS name string), optional 'chainId' and 'blockNumber' (numbers).
    parameters: z.object({ name: z.string(), chainId: z.coerce.number().optional(), blockNumber: z.coerce.number().optional(), }),
  • Local registration of the 'get-ens-address' tool within its dedicated register function, including name, description, schema, and handler.
    server.addTool({ name: "get-ens-address", description: "Get the ENS address for name", parameters: z.object({ name: z.string(), chainId: z.coerce.number().optional(), blockNumber: z.coerce.number().optional(), }), execute: async (args) => { const name = args.name const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const blockNumber = args.blockNumber ? BigInt(args.blockNumber) : undefined const result = await getEnsAddress(wagmiConfig, { name: normalize(name), blockNumber, chainId, }) return { content: [ { type: "text", text: result ?? "undefined", }, ], } }, });
  • Top-level registration call in the main server file that invokes the tool's register function to add it to the FastMCP server.
    registerGetENSAddressTools(server);

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/mcpilot'

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