convert_temperature
Converts a temperature value between Celsius, Fahrenheit, and Kelvin using exact offset-and-scale formulas.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
value | number | Yes | Numeric temperature value to convert. |
from | string | Yes | Source unit: c or celsius, f or fahrenheit, k or kelvin |
to | string | Yes | Target unit: c or celsius, f or fahrenheit, k or kelvin |
Response
| Field | Type | Description |
|---|---|---|
result | number | Converted value. |
Example
{
"value": 100,
"from": "c",
"to": "f"
}
Result:
{
"result": 212.0
}
More examples
value | from | to | result |
|---|---|---|---|
0 | c | k | 273.15 |
32 | f | c | 0.0 |
0 | k | c | -273.15 |
37 | c | f | 98.6 |
Errors
Each failure carries a precise code in the response. Argument-schema and server errors are JSON-RPC protocol errors; a rejected value is returned as a tool result with isError: true (so the agent can read the code and self-correct).
| Code | When | Delivered as |
|---|---|---|
invalid_arguments | value is missing or not a number, or from/to is missing or not a string. | protocol error (invalid_params) |
invalid_unit | from or to is not a recognised unit. The error message lists the accepted unit strings. | tool error (isError) |
internal_error | An unexpected server error. | protocol error (internal_error) |
Notes
- Both short forms (
c,f,k) and full names (celsius,fahrenheit,kelvin) are accepted and are case-sensitive. - Conversion uses the exact formulas: C→F:
°C × 9/5 + 32, C↔K:±273.15 offset. - All results are 64-bit floating-point numbers.