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
| Name | Required | Description | Default |
|---|---|---|---|
| blockNumber | No | ||
| chainId | No | ||
| name | Yes |
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(), }),
- packages/metamask-mcp/src/tools/get-ens-address.ts:8-34 (registration)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", }, ], } }, });
- packages/metamask-mcp/src/index.ts:49-49 (registration)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);