Skip to main content

base32_decode

Decode a Base32 string encoded with the standard alphabet (RFC 4648 §6) back to UTF-8 text. The standard alphabet uses uppercase A–Z and digits 2–7. Padding (=) is required — missing or malformed padding causes a decode error.

For decoding Base32Hex strings (uses 0–9 and A–V), use base32_decode_hex instead.

Parameters​

ParameterTypeRequiredDescription
inputstringYesThe standard Base32 string to decode. Padding (=) is required.

Response​

FieldTypeDescription
outputstringThe decoded UTF-8 plaintext.

Examples​

Decode a padded standard Base32 string​

{
"input": "NBSWY3DPEB3W64TMMQ======"
}

Result:

{
"output": "hello world"
}

Attempt to decode without padding​

Omitting the required = padding characters returns an error:

{
"input": "NBSWY3DPEB3W64TMMQ"
}

Result:

{
"isError": true,
"structuredContent": {
"error": {
"code": "base32_decode_failed",
"message": "base32 decode error: invalid length at 1",
"details": null
}
}
}

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 is not valid standard Base32 — it contains characters outside the A–Z, 2–7 alphabet, or the required = padding is missing or malformed.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 standard Base32 string. Use base32_decode_hex for Base32Hex encoded strings.
  • Padding (=) is required for this variant. Missing or incorrect padding will cause a decode error.
  • The standard alphabet is uppercase-only. Lowercase input is 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.