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
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | Yes | The standard Base32 string to decode. Padding (=) is required. |
Response
| Field | Type | Description |
|---|---|---|
output | string | The 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).
| Code | When | Delivered as |
|---|---|---|
invalid_arguments | The input field is missing or not a string. | protocol error (invalid_params) |
base32_decode_failed | The 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_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 standard Base32 string. Use
base32_decode_hexfor 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_utf8tool error (isError). This tool cannot handle binary payloads.