numfmt
Convert numbers between plain, SI (K, M, G), and IEC binary (Ki, Mi, Gi) unit systems. Parses human-readable strings with suffixes back to raw numbers.
Instructions
Convert numbers between plain, SI (K, M, G), and IEC binary (Ki, Mi, Gi) unit systems. Read-only, no side effects. Parses human-readable strings with SI/IEC suffixes back to raw numbers. Returns JSON with the converted value by default; use --raw for plain output. Use to humanize byte counts or parse user-supplied size strings. Not for formatted string output — use 'printf' for general formatting. See also 'printf'.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "numfmt"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | Write converted numbers without a JSON envelope. | |
| numbers | No | Numbers to convert. Defaults to whitespace tokens from stdin. | |
| to_unit | No | Output unit system. | none |
| encoding | No | Output encoding (default: utf-8). Use 'auto' for BOM/autodetection. | utf-8 |
| from_unit | No | Input unit system. | none |
| max_lines | No | Maximum JSON records to emit. | |
| precision | No | Digits after the decimal point before trimming zeros. | |
| show_encoding | No | Include encoding detection metadata in JSON result. | |
| encoding_errors | No | How to handle encoding errors (default: replace). | replace |
| encoding_profile | No | Locale-aware encoding fallback profile for auto-detection. |