Skip to main content
Glama

Percent composition

percent_composition
Read-only

Calculate the mass percentage of each element in a chemical formula and return the molar mass, so you can determine elemental composition from a formula such as H2O or Ca(OH)2.

Instructions

Find the percent by mass of each element in a chemical formula, along with the molar mass. This is the reverse of empirical_formula.

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": "percent_composition"
  }
}

Input Schema

NameRequiredDescriptionDefault
formulaYesChemical formula like H2O, Ca(OH)2 or CuSO4.5H2O. Write each element with a capital first letter.

Output Schema

NameRequiredDescriptionDefault
massYes
elementsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.3

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered; the description adds that the result includes molar mass alongside the per-element percentages. It says nothing about behavior on malformed or ambiguous formulas (e.g. invalid capitalization or hydrates without the dot), which is the main failure mode for a formula parser.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero filler, with the primary output stated before the sibling cross-reference. Nothing could be removed without losing information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter, deterministic, read-only calculation with a full output schema declaring the return shape, the description covers what the tool computes and what it relates to. The only remaining gap, error behavior, is not required for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema fully documents the single parameter with concrete examples (H2O, Ca(OH)2, CuSO4.5H2O) and the capitalization rule, so schema coverage is 100% and baseline is 3. The description only restates "chemical formula" and adds no format or edge-case guidance beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific computation and its output: percent by mass of each element plus molar mass, for a chemical formula. It also names the sibling relationship ("reverse of empirical_formula"), so an agent can separate it from that tool without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Reverse of empirical_formula" gives an explicit directional cue for choosing between the two related siblings. It gives no exclusion against the other plausible distractor, molar_mass, which also returns molar mass, so the agent must infer whether to call this or that one.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.