base32_decode_hex
Decode a Base32Hex string encoded with the extended hex alphabet (RFC 4648 §7) back to UTF-8 text. The hex alphabet uses digits 0–9 and uppercase letters A–V. Padding (=) is optional — both padded and unpadded input is accepted.
For decoding standard Base32 strings (uses A–Z and 2–7), use base32_decode instead.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | Yes | The Base32Hex string to decode (RFC 4648 §7, uses 0–9 and A–V). Padding (=) is optional. |
Response
| Field | Type | Description |
|---|---|---|
output | string | The decoded UTF-8 plaintext. |
Examples
Decode a padded Base32Hex string
{
"input": "D1IMOR3F"
}
Result:
{
"output": "hello"
}
Decode an unpadded Base32Hex string
Unlike the standard variant, padding is optional for Base32Hex decoding:
{
"input": "D0"
}
Result:
{
"output": "h"
}
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 | The input field is missing or not a string. | protocol error (invalid_params) |
base32_decode_failed | The input contains characters not in the Base32Hex alphabet (0–9, A–V). | tool error (isError) |
invalid_utf8 | The input decoded successfully, but the resulting bytes are not valid UTF-8 text. | tool error (isError) |
internal_error | An unexpected server error. | protocol error (internal_error) |
Notes
- The input must be a valid Base32Hex string. Use
base32_decodefor standard Base32 encoded strings — the alphabets are incompatible. - Padding (
=) is optional for this variant. Both padded and unpadded input is accepted. - The hex alphabet is uppercase-only (
0–9,A–V). Characters outside this range — including lettersW,X,Y,Zand all lowercase letters — are rejected. - If the decoded bytes are not valid UTF-8, the tool returns an
invalid_utf8tool error (isError). This tool cannot handle binary payloads.