parseEther
Convert ether values into a standardized format for blockchain transactions. Simplifies handling ether amounts in Ethereum networks through the MCP Ethers Wallet.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ether | Yes | The ether value to parse |
Implementation Reference
- src/tools/core.ts:316-335 (handler)The handler function for the parseEther tool. It takes an 'ether' string input, converts it to wei using ethers.parseEther(ether), and returns the wei value as a string. Includes error handling.async ({ ether }) => { try { const weiValue = ethers.parseEther(ether); return { content: [{ type: "text", text: weiValue.toString() }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error parsing ether: ${error instanceof Error ? error.message : String(error)}` }] }; } }
- src/tools/core.ts:311-315 (schema)Input schema for parseEther tool: requires a single 'ether' parameter as a string.{ ether: z.string().describe( "The ether value to parse" ) },
- src/tools/core.ts:310-336 (registration)Registration of the parseEther tool on the MCP server, including schema and handler."parseEther", { ether: z.string().describe( "The ether value to parse" ) }, async ({ ether }) => { try { const weiValue = ethers.parseEther(ether); return { content: [{ type: "text", text: weiValue.toString() }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `Error parsing ether: ${error instanceof Error ? error.message : String(error)}` }] }; } } );