molar-mass-calculator
Compute the molar mass (g/mol) of a chemical compound from its formula. Parses standard notation with element symbols, subscripts, nested parentheses, and hydrate dots. Returns the total molar mass and a per-element breakdown.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"formula": "<formula>"
},
"name": "molar-mass-calculator"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| formula | Yes | Chemical formula in standard notation. Element symbols use a capital letter optionally followed by one lowercase letter (Na, Cl, Fe). Subscripts are written as plain digits after the symbol or group (H2O, C6H12O6, Ca(OH)2). Parentheses group atoms with a shared subscript. Hydrate notation with a dot is supported (CuSO4·5H2O). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| formula | Yes | The original input formula, unchanged. | |
| breakdown | Yes | Per-element breakdown in Hill order (C, H, then alphabetical). Each entry has the element symbol, total atom count in the formula, atomic weight (g/mol), and contribution to the total (count × atomicWeight). | |
| molarMass | Yes | Molar mass in grams per mole (g/mol). | |
| normalized | Yes | The input with whitespace stripped and unicode subscripts converted to ASCII digits. |