parseEther
Convert ether values from human-readable strings to precise Wei units for blockchain transactions and calculations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ether | Yes | The ether value to parse |
Implementation Reference
- src/tools/core.ts:317-336 (handler)The main handler function for the 'parseEther' MCP tool. It takes an ether amount as a string, uses ethers.parseEther to convert it to wei (bigint), and returns the wei value as a string.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:312-316 (schema)Zod input schema for the parseEther tool, defining the 'ether' parameter as a string.ether: z.string().describe( "The ether value to parse" ) }, async ({ ether }) => {
- src/tools/core.ts:310-310 (registration)Registration of the parseEther tool using server.tool() within registerCoreTools function."parseEther",
- src/tools/core.ts:894-894 (helper)Helper usage of ethers.parseEther inside sendTransaction tool.value: ethers.parseEther(value),
- src/tools/core.ts:1020-1020 (helper)Helper usage of ethers.parseEther inside sendTransactionWithOptions tool.value: ethers.parseEther(value),