Skip to main content
Glama

getEnsResolutionGuidance

Resolve ENS names to addresses and retrieve blockchain data like balances, transaction counts, or contract code across different Ethereum networks.

Instructions

Get guidance for resolving ENS names across networks and performing operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ensNameYesThe ENS name to resolve (e.g., 'vitalik.eth')
targetNetworkYesThe target network to perform operations on (e.g., 'MEGA Testnet', 'Optimism')
operationYesThe operation to perform: 'balance' for ETH balance, 'txCount' for transaction count, 'code' for contract code

Implementation Reference

  • The handler function for the 'getEnsResolutionGuidance' tool. It generates step-by-step textual guidance for resolving an ENS name on Ethereum and performing the specified operation (balance, txCount, or code) on a target network using other tools.
    async ({ ensName, targetNetwork, operation }) => { try { // Define guidance for each type of operation let operationGuidance = ""; switch (operation) { case "balance": operationGuidance = `check the ETH balance of the resolved address on the ${targetNetwork} network`; break; case "txCount": operationGuidance = `check the transaction count of the resolved address on the ${targetNetwork} network`; break; case "code": operationGuidance = `check if the resolved address contains contract code on the ${targetNetwork} network`; break; } return { content: [{ type: "text", text: `Guidance for resolving ENS name '${ensName}' and ${operationGuidance}: 1. First, use the 'resolveName' tool with the provider set to 'Ethereum' to resolve the ENS name on Ethereum mainnet, as ENS domains are primarily registered there. 2. Before proceeding with the target network: - Use the 'getAllNetworks' tool to verify the exact name of the '${targetNetwork}' network - If the provided name doesn't match exactly, identify the correct network name from the results 3. After resolving the ENS name on Ethereum mainnet: - Use the resolved Ethereum address to perform the requested ${operation} operation on the target network - Use the appropriate tool ('getWalletBalance', 'getWalletTransactionCount', or 'getContractCode') with the provider parameter set to the verified target network name 4. Present the results clearly, specifying both: - The original ENS name and its resolved address - The network on which the operation was performed - The complete results of the operation This approach ensures reliable ENS resolution while allowing operations across any supported blockchain network.` }] }; } catch (error) { return createErrorResponse(error, 'getting ENS resolution guidance'); } }
  • Zod schema defining the input parameters for the tool: ensName (string), targetNetwork (string), operation (enum: balance, txCount, code). Used for validation.
    { ensName: z.string().describe("The ENS name to resolve (e.g., 'vitalik.eth')"), targetNetwork: z.string().describe("The target network to perform operations on (e.g., 'MEGA Testnet', 'Optimism')"), operation: z.enum(["balance", "txCount", "code"]).describe("The operation to perform: 'balance' for ETH balance, 'txCount' for transaction count, 'code' for contract code") },
  • Registration of the 'getEnsResolutionGuidance' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool( "getEnsResolutionGuidance", "Get guidance for resolving ENS names across networks and performing operations", { ensName: z.string().describe("The ENS name to resolve (e.g., 'vitalik.eth')"), targetNetwork: z.string().describe("The target network to perform operations on (e.g., 'MEGA Testnet', 'Optimism')"), operation: z.enum(["balance", "txCount", "code"]).describe("The operation to perform: 'balance' for ETH balance, 'txCount' for transaction count, 'code' for contract code") }, async ({ ensName, targetNetwork, operation }) => { try { // Define guidance for each type of operation let operationGuidance = ""; switch (operation) { case "balance": operationGuidance = `check the ETH balance of the resolved address on the ${targetNetwork} network`; break; case "txCount": operationGuidance = `check the transaction count of the resolved address on the ${targetNetwork} network`; break; case "code": operationGuidance = `check if the resolved address contains contract code on the ${targetNetwork} network`; break; } return { content: [{ type: "text", text: `Guidance for resolving ENS name '${ensName}' and ${operationGuidance}: 1. First, use the 'resolveName' tool with the provider set to 'Ethereum' to resolve the ENS name on Ethereum mainnet, as ENS domains are primarily registered there. 2. Before proceeding with the target network: - Use the 'getAllNetworks' tool to verify the exact name of the '${targetNetwork}' network - If the provided name doesn't match exactly, identify the correct network name from the results 3. After resolving the ENS name on Ethereum mainnet: - Use the resolved Ethereum address to perform the requested ${operation} operation on the target network - Use the appropriate tool ('getWalletBalance', 'getWalletTransactionCount', or 'getContractCode') with the provider parameter set to the verified target network name 4. Present the results clearly, specifying both: - The original ENS name and its resolved address - The network on which the operation was performed - The complete results of the operation This approach ensures reliable ENS resolution while allowing operations across any supported blockchain network.` }] }; } catch (error) { return createErrorResponse(error, 'getting ENS resolution guidance'); } } );

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/crazyrabbitLTC/mcp-ethers-server'

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