Skip to main content

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​

ParameterTypeRequiredDescription
inputstringYesThe Base32Hex string to decode (RFC 4648 §7, uses 0–9 and A–V). Padding (=) is optional.

Response​

FieldTypeDescription
outputstringThe 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).

CodeWhenDelivered as
invalid_argumentsThe input field is missing or not a string.protocol error (invalid_params)
base32_decode_failedThe input contains characters not in the Base32Hex alphabet (0–9, A–V).tool error (isError)
invalid_utf8The input decoded successfully, but the resulting bytes are not valid UTF-8 text.tool error (isError)
internal_errorAn unexpected server error.protocol error (internal_error)

Notes​

  • The input must be a valid Base32Hex string. Use base32_decode for 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 letters W, X, Y, Z and all lowercase letters — are rejected.
  • If the decoded bytes are not valid UTF-8, the tool returns an invalid_utf8 tool error (isError). This tool cannot handle binary payloads.