Skip to main content
Glama

Convert units

convert_units
Read-only

Convert a number between two units of the same category and return a line such as "5 mi = 8.04672 km" (up to 10 significant digits). Units are matched by symbol or name, case-insensitive. Errors are returned for unknown units, units from another category, non-numeric values and temperatures below absolute zero. Months are 1/12 of a 365-day year. Units by category (symbols): length: m, km, mi, ft, in, cm, mm, yd, nmi; weight: kg, g, lb, oz, t, mg, st; temperature: °C, °F, K; volume: L, mL, gal, fl oz, cup, tbsp, m³; speed: km/h, mph, m/s, kn, ft/s; area: m², km², mi², ft², ac, ha; data: B, KB, MB, GB, TB, bit, KiB, MiB, GiB, TiB; time: s, min, h, d, wk, mo, yr, ms.

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": {
      "value": "<value>",
      "category": "<category>",
      "from": "<from>",
      "to": "<to>"
    },
    "name": "convert_units"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesUnit symbol or name, e.g. mi or mile
fromYesUnit symbol or name, e.g. km or kilometer
valueYesA plain number such as 12.5, -40 or 1e6 (no commas or unit text)
categoryYesThe kind of quantity; both units must belong to it

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / category / description
      Added value: +"The kind of quantity; both units must belong to it"
    • changedInput schema / properties / value / description
      Previous value: -"A plain number, e.g. 12.5"New value: +"A plain number such as 12.5, -40 or 1e6 (no commas or unit text)"
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already cover the safe-read profile (readOnlyHint, non-destructive, closed-world), and the description adds real substance on top: ten-significant-digit output, explicit error cases including sub-absolute-zero temperatures, and the convention that months equal 1/12 of a 365-day year. Only minor gaps remain, such as how rounding beyond ten digits is handled.

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

Conciseness4/5

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

Purpose and return format are front-loaded, followed by matching rules, error behavior, and the unit catalog. The category list is long but functional reference data for a converter; nothing reads as filler, though the density of the trailing list makes it slightly scan-heavy.

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?

With no output schema, the description still describes the returned line and its precision, covers all error conditions, and enumerates the full valid unit vocabulary per category. An agent could invoke this correctly without inspecting the schema further.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description earns more by mapping every category to its accepted unit symbols, which tells the agent what strings actually work for `from` and `to`. This is meaning the schema's 'e.g. mi or mile' hints at but does not exhaustively supply.

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 verb and resource ('convert a number between two units of the same category') and even shows the exact return shape ('5 mi = 8.04672 km'). This is unambiguous and cannot be confused with the unrelated siblings such as hash_text or convert_timestamp.

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?

The description establishes the operating envelope: units must share a category, matching is by symbol or name and case-insensitive, and non-numeric or cross-category inputs produce errors. It doesn't name alternatives, but none of the listed siblings overlap, so an agent needs no routing guidance beyond this.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.