mcp-gnu-units

v0.1.1
mcp-gnu-units Checked 14 hours ago Published 1 month ago

Unit converter powered by the GNU units database — convert between 3000+ units of measurement, evaluate compound unit expressions, reduce quantities to SI…

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

info

Discovery / health-check entrypoint: report availability and version info. Returns seven keys: `status` ("available"), `name`, `version` (package version), `python` (runtime version), `mcp_sdk` (MCP SDK version, or "unknown"), `toolsets` (empty until the GNU units engine lands), and `units_db` — the bundled GNU units database's `source`, `data_version`, and `data_updated` (§2.4.6 / §5.4), read from the shipped file's own header so it can't drift. Example: {"status":"available","name":"mcp-gnu-units","version":"0.0.1", "python":"3.12.3","mcp_sdk":"1.28.0","tools…

find_units

Search the GNU units database for units whose name or definition contains a keyword. Basic substring search over the 3000+ unit GNU units database (TODO §14.1). A hit is any unit whose name OR definition text contains `query` (case-insensitive); prefixes are excluded. Results are returned in the database's native order and capped at `limit`. Use this to discover the exact spelling of a unit before calling a conversion tool. Returns: `query` (echoed), `count` (number of results returned), and `results`, a list of objects each carrying: - `name` : the u…

ParameterTypeDescription
query *stringCase-insensitive substring to search for. Matches against both the unit NAME and its DEFINITION text, so 'meter' finds the `meter` unit itself as well as units defined in terms of it (e.g. `micron`).…
limitintegerMaximum number of matches to return (results are in the database's native definition order; the scan stops once this many are found).

convert

Convert a value or unit expression from one unit to another (GNU units engine, TODO §16). The universal conversion core: one tool covers every category (length, mass, time, temperature, area, volume, energy, power, speed, data, …) plus compound expressions like `kW*h` or `acre*ft`. Linear conversions return the ratio of coefficients; a nonlinear target (e.g. `tempF`) applies that unit's inverse. Returns: `from` and `to` (echoed), `result` (the converted magnitude WITH the target unit, e.g. "1.609344 km" — the primary human-readable answer), `value` (the same…

ParameterTypeDescription
from_expr *stringThe quantity or unit expression to convert FROM. May carry a numeric coefficient and be a compound expression: '2.5 acre*ft', '55 mile/hour', 'kW*h', '0 tempC'. A bare unit like 'mile' is treated as o…
to_expr *stringThe unit expression to convert TO, e.g. 'km', 'gallons', 'joule', 'tempF'. Must be dimensionally conformable with `from_expr` (both length, both energy, …) or a nonlinear target such as 'tempF'; oth…

convert_to_si

Reduce a value or unit expression to its SI base units (GNU units engine, TODO §17). Rewrites any expression in terms of the database's primitive/base units — kg, m, s, A, K, mol, cd, and the like — collapsing all derived and prefixed units. This is how you see what a quantity *really* is dimensionally: `kW*hour` becomes `3600000 kg m^2 / s^2` (3.6 MJ), `newton` becomes `1 kg m / s^2`. Use it to compare or sanity-check units, or to get a magnitude in coherent SI. Returns: `expr` (echoed), `result` (the reduced quantity WITH its base-unit signature, e.g. "3600…

ParameterTypeDescription
expr *stringThe quantity or unit expression to reduce to SI base units. May carry a numeric coefficient and be compound: 'kW*hour', '100 W', 'acre ft', '55 mile/hour'. A bare unit like 'newton' is treated as one…

define_unit

Show a single unit/prefix/constant's definition, kind, dimension, and base value (TODO §13). Looks up one name in the GNU units database and reports exactly what it is and what it reduces to — the inspect/"define" counterpart to `convert`. Works for ordinary units, SI/binary prefixes, physical constants, nonlinear function units (`tempF`), and piecewise tables (`brwiregauge`). Returns an object with: - `name` : echoed. - `kind` : "unit" | "primitive" | "prefix" | "function" | "table". - `definition` : the database definition text (source l…

ParameterTypeDescription
name *stringThe exact name of a single unit, prefix, physical constant, function, or table to look up — e.g. 'horsepower', 'kilo', 'newton', 'tempF', 'brwiregauge'. This is a definition lookup, not an expressio…

list_prefixes

List every SI and binary prefix in the GNU units database with its multiplier (TODO §13). Enumerates all defined prefixes — the SI decimal ladder (`quetta`…`quecto` and their symbols `Q`…`q`) plus the binary/IEC prefixes (`kibi`/`Ki`, `mebi`/`Mi`, …) — sorted by descending magnitude. Useful for discovering the exact prefix spelling to use in a `convert` or `convert_to_si` expression, or for seeing a prefix's exact numeric value. Returns: `count` (number of prefixes) and `prefixes`, a list of objects each with `name` (the prefix, without its trailing hyp…