Skip to main content
Glama

formatEther

Convert wei values to human-readable ether amounts for Ethereum transactions and balances.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
weiYesThe wei value to format

Implementation Reference

  • The execution handler for the 'formatEther' MCP tool. Takes a wei string input and uses ethers.formatEther to convert it to ether units, returning the formatted string.
    async ({ wei }) => { try { const etherValue = ethers.formatEther(wei); return { content: [{ type: "text", text: etherValue }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error formatting ether: ${error instanceof Error ? error.message : String(error)}` }] }; } }
  • The input schema for the 'formatEther' tool, validating the 'wei' parameter as a string.
    wei: z.string().describe( "The wei value to format" )
  • The registration of the 'formatEther' tool using server.tool() within the registerCoreTools function.
    "formatEther", { wei: z.string().describe( "The wei value to format" ) }, async ({ wei }) => { try { const etherValue = ethers.formatEther(wei); return { content: [{ type: "text", text: etherValue }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error formatting ether: ${error instanceof Error ? error.message : String(error)}` }] }; } }

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