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
| Name | Required | Description | Default |
|---|---|---|---|
| address | Yes | Address to get the name for. | |
| chainId | No | ID of chain to use when fetching data. | |
| blockNumber | No | Block number to get name at. |
Implementation Reference
- src/tools/get-ens-name.ts:16-26 (handler)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", }, ], }; }, - src/tools/get-ens-name.ts:11-15 (schema)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."), }), - src/tools/get-ens-name.ts:7-28 (registration)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", }, ], }; }, }); }; - src/tools/register-tools.ts:47-47 (registration)Invocation of the tool registration function within the main registerTools aggregator.
registerGetENSNameTools(server, wagmiConfig);