Skip to main content
Glama
lienhage
by lienhage

validate-ethereum-address

Verify the correctness of an Ethereum address using the Blockchain MCP Server tool, ensuring it meets the required format and standards.

Instructions

Validate the validity of an Ethereum address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesEthereum address to validate

Implementation Reference

  • The handler function for the 'validate-ethereum-address' tool. It uses ethers.isAddress(address) to validate the Ethereum address, computes the checksummed version if valid, and returns a formatted text response indicating validity.
    async ({ address }) => { try { const isValid = ethers.isAddress(address); const checksumAddress = isValid ? ethers.getAddress(address) : null; return { content: [{ type: "text", text: `Address validation result: 🔹 Original Address: ${address} 🔹 Valid: ${isValid ? '✅ Valid' : '❌ Invalid'} ${checksumAddress ? `🔹 Checksum Address: ${checksumAddress}` : ''}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error validating address: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • The input schema for the 'validate-ethereum-address' tool, defining the 'address' parameter using Zod.
    { title: "Validate Ethereum Address", description: "Validate the validity of an Ethereum address", inputSchema: { address: z.string().describe("Ethereum address to validate") } },
  • Registration of the 'validate-ethereum-address' tool on the McpServer, including schema and inline handler function.
    server.registerTool( "validate-ethereum-address", { title: "Validate Ethereum Address", description: "Validate the validity of an Ethereum address", inputSchema: { address: z.string().describe("Ethereum address to validate") } }, async ({ address }) => { try { const isValid = ethers.isAddress(address); const checksumAddress = isValid ? ethers.getAddress(address) : null; return { content: [{ type: "text", text: `Address validation result: 🔹 Original Address: ${address} 🔹 Valid: ${isValid ? '✅ Valid' : '❌ Invalid'} ${checksumAddress ? `🔹 Checksum Address: ${checksumAddress}` : ''}` }] }; } catch (error) { return { content: [{ type: "text", text: `Error validating address: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );

Other Tools

Related 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/lienhage/blockchain-mcp'

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