Skip to main content
Glama
buildwithgrove

Grove's MCP Server for Pocket Network

reverse_resolve_domain

Convert any Ethereum address to its corresponding ENS domain name using Grove's blockchain data service.

Instructions

Reverse resolve an Ethereum address to its ENS domain name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesEthereum address to reverse resolve

Implementation Reference

  • Core implementation of reverse domain resolution for ENS domains using Ethereum RPC calls to the ENS public resolver, including verification via forward resolution.
    async reverseResolve(address: string): Promise<EndpointResponse> { try { // ENS reverse registrar const reverseNode = this.getReverseNode(address); // Get the name from the reverse resolver const nameData = this.encodeNameCall(reverseNode); const nameResult = await this.blockchainService.callRPCMethod( 'ethereum-mainnet', 'eth_call', [ { to: DomainResolverService.ENS_PUBLIC_RESOLVER, data: nameData, }, 'latest', ] ); if (!nameResult.success || !nameResult.data) { return { success: false, error: `No reverse record found for ${address}`, }; } const domain = this.decodeString(nameResult.data); if (!domain) { return { success: false, error: `No reverse record found for ${address}`, }; } // Verify forward resolution matches const forwardResult = await this.resolveENS(domain); if (forwardResult.success && forwardResult.data?.address.toLowerCase() === address.toLowerCase()) { return { success: true, data: { address, domain, type: 'ENS', verified: true, }, metadata: { timestamp: new Date().toISOString(), endpoint: 'ethereum-mainnet', }, }; } return { success: false, error: `Reverse record found but forward resolution mismatch`, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Unknown error in reverse resolution', }; } }
  • MCP tool handler switch case that extracts the address argument and delegates to DomainResolverService.reverseResolve().
    case 'reverse_resolve_domain': { const address = args?.address as string; const result = await domainResolver.reverseResolve(address); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], isError: !result.success, }; }
  • Tool schema definition including name, description, and input schema for the reverse_resolve_domain tool.
    { name: 'reverse_resolve_domain', description: 'Reverse resolve an Ethereum address to its ENS domain name', inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'Ethereum address to reverse resolve', }, }, required: ['address'], }, },
  • Registration function that defines and returns the Tool[] array including reverse_resolve_domain for registration with the MCP server.
    export function registerDomainHandlers( server: Server, domainResolver: DomainResolverService ): Tool[] { const tools: Tool[] = [ { name: 'resolve_domain', description: 'Resolve a blockchain domain name (ENS .eth or Unstoppable Domains) to an address using Pocket Network endpoints', inputSchema: { type: 'object', properties: { domain: { type: 'string', description: 'The domain name to resolve (e.g., "vitalik.eth", "alice.crypto")', }, }, required: ['domain'], }, }, { name: 'reverse_resolve_domain', description: 'Reverse resolve an Ethereum address to its ENS domain name', inputSchema: { type: 'object', properties: { address: { type: 'string', description: 'Ethereum address to reverse resolve', }, }, required: ['address'], }, }, { name: 'get_domain_records', description: 'Get ENS text records for a domain (e.g., avatar, email, url, twitter, github)', inputSchema: { type: 'object', properties: { domain: { type: 'string', description: 'ENS domain name', }, keys: { type: 'array', items: { type: 'string' }, description: 'Text record keys to fetch (e.g., ["avatar", "email", "url", "com.twitter", "com.github"])', }, }, required: ['domain', 'keys'], }, }, ]; return tools; }

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/buildwithgrove/mcp-pocket'

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