Skip to main content
Glama

toolkit-mcp-server: encode value

toolkit_encode_value
Read-onlyIdempotent

Encode or decode a value across base64, base64url, hex, or URL (percent) encoding, in either direction. Set operation to "encode" to transform raw UTF-8 text into the chosen encoding, or "decode" to recover the original bytes from an encoded value. Decoded bytes come back as UTF-8 text by default; set outputEncoding to "hex", "base64", or "base64url" (unpadded, the form JWK members, JWS signatures, and PKCE code challenges use) to receive them re-encoded instead, which is lossless for binary data and transcodes between encodings (a base64 digest to hex, or hex key bytes to base64url, for example). Decoding never substitutes replacement characters: bytes that are not valid UTF-8 text are reported as a recoverable error that points at outputEncoding. Whitespace in hex, base64, and base64url values is ignored, so line-wrapped MIME bodies and PEM bodies decode as-is (drop PEM's -----BEGIN/END----- lines, which are not base64). base64url uses the URL-safe alphabet (- and _ instead of + and /); url applies encodeURIComponent and percent-decoding. A value that is malformed for the chosen encoding is reported as a recoverable error, not a silent best-effort.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "operation": "<operation>",
      "encoding": "<encoding>",
      "value": "<value>"
    },
    "name": "toolkit_encode_value"
  }
}

Input Schema

NameRequiredDescriptionDefault
valueYesThe value to transform — raw text for encode, an encoded string for decode. Whitespace is ignored when decoding hex, base64, or base64url; a url value is taken literally.
encodingYesThe encoding to apply: base64, URL-safe base64url, hex, or URL percent-encoding.
operationYes"encode" transforms text into the encoding; "decode" recovers the bytes from an encoded value.
outputEncodingNoDecode only: how the recovered bytes are returned. utf8 (used when omitted) returns text and fails when the bytes are not valid UTF-8; hex, base64, and base64url (unpadded) return the raw bytes re-encoded, losslessly. Rejected when operation is "encode".

Output Schema

NameRequiredDescriptionDefault
errorNoPresent when the call failed. Absent on success.
resultNoThe transformed value: encoded text for encode; for decode, the recovered bytes as UTF-8 text, hex, base64, or unpadded base64url per outputEncoding.
encodingNoThe encoding that was applied.
operationNoThe operation that was performed.
outputEncodingNoHow result renders the decoded bytes: utf8 text, hex, base64, or unpadded base64url. Present for operation "decode".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • changedInput schema / properties / outputEncoding / description
      Previous value: -"Decode only: how the recovered bytes are returned. utf8 (used when omitted) returns text and fails when the bytes are not valid UTF-8; hex and base64 return the raw bytes re-encoded, losslessly. Rejected when operation is \"encode\"."New value: +"Decode only: how the recovered bytes are returned. utf8 (used when omitted) returns text and fails when the bytes are not valid UTF-8; hex, base64, and base64url (unpadded) return the raw bytes re-encoded, losslessly. Rejected when operation is \"encode\"."
    • changedInput schema / properties / outputEncoding / enum
      Previous value: -[
      -  "utf8",
      -  "hex",
      -  "base64"
      -]New value: +[
      +  "utf8",
      +  "hex",
      +  "base64",
      +  "base64url"
      +]
    • changedOutput schema / properties / outputEncoding / description
      Previous value: -"How result renders the decoded bytes: utf8 text, hex, or base64. Present for operation \"decode\"."New value: +"How result renders the decoded bytes: utf8 text, hex, base64, or unpadded base64url. Present for operation \"decode\"."
    • changedOutput schema / properties / outputEncoding / enum
      Previous value: -[
      -  "utf8",
      -  "hex",
      -  "base64"
      -]New value: +[
      +  "utf8",
      +  "hex",
      +  "base64",
      +  "base64url"
      +]
    • changedOutput schema / properties / result / description
      Previous value: -"The transformed value: encoded text for encode; for decode, the recovered bytes as UTF-8 text, hex, or base64 per outputEncoding."New value: +"The transformed value: encoded text for encode; for decode, the recovered bytes as UTF-8 text, hex, base64, or unpadded base64url per outputEncoding."
  2. Changed7 schema fields changed
    • changedInput schema / properties / operation / description
      Previous value: -"\"encode\" transforms text into the encoding; \"decode\" recovers text from an encoded value."New value: +"\"encode\" transforms text into the encoding; \"decode\" recovers the bytes from an encoded value."
    • addedInput schema / properties / outputEncoding
      Added value: +{
      +  "description": "Decode only: how the recovered bytes are returned. utf8 (used when omitted) returns text and fails when the bytes are not valid UTF-8; hex and base64 return the raw bytes re-encoded, losslessly. Rejected when operation is \"encode\".",
      +  "enum": [
      +    "utf8",
      +    "hex",
      +    "base64"
      +  ],
      +  "type": "string"
      +}
    • changedInput schema / properties / value / description
      Previous value: -"The value to transform — raw text for encode, an encoded string for decode."New value: +"The value to transform — raw text for encode, an encoded string for decode. Whitespace is ignored when decoding hex, base64, or base64url; a url value is taken literally."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `decode_failed`: operation is \"decode\" but value is malformed for the chosen encoding. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `decode_failed`: operation is \"decode\" but value is malformed for the chosen encoding. `decode_not_utf8`: operation is \"decode\", outputEncoding is utf8 (or omitted), and the decoded bytes are not valid UTF-8 text. `output_encoding_not_applicable`: operation is \"encode\" and outputEncoding was supplied; it selects how decoded bytes are returned. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "decode_failed"
      -]New value: +[
      +  "decode_failed",
      +  "decode_not_utf8",
      +  "output_encoding_not_applicable"
      +]
    • addedOutput schema / properties / outputEncoding
      Added value: +{
      +  "description": "How result renders the decoded bytes: utf8 text, hex, or base64. Present for operation \"decode\".",
      +  "enum": [
      +    "utf8",
      +    "hex",
      +    "base64"
      +  ],
      +  "type": "string"
      +}
    • changedOutput schema / properties / result / description
      Previous value: -"The transformed value (encoded text, or the decoded original)."New value: +"The transformed value: encoded text for encode; for decode, the recovered bytes as UTF-8 text, hex, or base64 per outputEncoding."
  3. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "encoding",
      +      "operation",
      +      "result"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode. Declared by this tool: `decode_failed`: operation is \"decode\" but value is malformed for the chosen encoding. Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "decode_failed"
      +          ],
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "encoding",
      -  "operation",
      -  "result"
      -]
  4. First observed

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/closed-world, but the description goes well beyond them: it promises recoverable errors rather than silent best-effort on malformed input, guarantees no replacement-character substitution on invalid UTF-8, documents whitespace tolerance for hex/base64/base64url, and notes outputEncoding is rejected when encoding.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and direction are front-loaded in the first sentence, and each subsequent sentence covers a distinct concern (direction, output form, error policy, whitespace, alphabet details). It is dense and runs long, with some detail (base64url alphabet characters) that borders on tutorial rather than tool selection.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 4-parameter, enum-heavy transform tool with an output schema already describing return shape, the description covers everything an agent needs: mode selection, binary-safe output, whitespace handling, and precise failure semantics. Nothing material about calling it correctly is left out.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description earns more by adding meaning the schema lacks — that base64url output is unpadded and is the form used by JWK members, JWS signatures, and PKCE challenges, and that url applies encodeURIComponent with literal input on decode. It does not, however, cover every parameter nuance beyond what the schema already states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb pair (encode/decode) on a specific resource (a value) across four named encodings, in either direction. It is clearly distinguishable from siblings like toolkit_hash_value or toolkit_generate_id, which do not transform between encodings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly tells the agent when to pick operation=encode versus decode, and when to supply outputEncoding (binary data, or transcoding between encodings such as base64 digest to hex). It gives a concrete operational caveat for PEM bodies (drop the BEGIN/END lines). It does not name a sibling tool or state when not to use this one, which keeps it below a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.