{
  "openapi": "3.1.1",
  "info": {
    "title": "Emoji Cipher Playground API",
    "version": "1.0.0",
    "summary": "Turn secret notes into emoji and back: substitution, Caesar shift and base-emoji.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://emojicipherplayground.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "Turn secret notes into emoji and back: substitution, Caesar shift and base-emoji.",
        "description": "Encode or decode text with three emoji ciphers: a keyed substitution (your key shuffles the emoji alphabet), a Caesar shift over an emoji alphabet, or base-emoji, which turns every UTF-8 byte into one of 256 emoji so any text survives. Round trips are exact — and the tool shows why none of this is real encryption.\n\nMethodology:\n- Letter schemes map a–z and 0–9 to 36 emoji (🍎 a, 🐝 b, 🐱 c … and clock faces for digits). Keyed substitution shuffles that alphabet with a generator seeded by your key; Caesar shifts letters by k (mod 26) and digits by k (mod 10) before mapping.\n- Capital letters get the marker 🔼 in front. Characters that would be ambiguous (the alphabet emoji themselves, 🔼, the escape emoji 🔣 and the invisible emoji variation selector) are written as 🔣 + character. Everything else (spaces, punctuation, accents) passes through unchanged. This makes decode(encode(text)) exact, which the tool verifies on every run.\n- Base-emoji encodes the UTF-8 bytes of the text, one emoji per byte, using a fixed table of 256 emoji (U+1F300 upwards); an optional key shuffles the table. It works for any text, including emoji, but makes messages about 4× longer in code points.\n- Security: none. Letter ciphers keep word lengths, spaces and letter frequencies (the most common emoji is probably “e”), so frequency analysis breaks them in minutes; Caesar has only 26 keys. Base-emoji is an encoding, like Base64 — with the standard table anyone can decode it. Use real encryption (e.g. age, GPG or an end-to-end encrypted messenger) for secrets.\n\nA toy for puzzles, games and party invitations. It does not protect anything.",
        "tags": [
          "fun"
        ],
        "x-mcp-tool": "emoji_cipher_playground",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmojiCipherPlaygroundInput"
              },
              "examples": {
                "example1": {
                  "summary": "Secret note with a keyed substitution",
                  "value": {
                    "action": "encode",
                    "scheme": "substitution",
                    "text": "Meet me at 7 by the old oak tree!",
                    "key": "picnic"
                  }
                },
                "example2": {
                  "summary": "Caesar shift 3",
                  "value": {
                    "action": "encode",
                    "scheme": "caesar",
                    "text": "Hello World",
                    "shift": 3
                  }
                },
                "example3": {
                  "summary": "Base-emoji round trip (any text, even emoji)",
                  "value": {
                    "action": "encode",
                    "scheme": "base-emoji",
                    "text": "Grüße 👋",
                    "key": ""
                  }
                },
                "example4": {
                  "summary": "Decode a Caesar message",
                  "value": {
                    "action": "decode",
                    "scheme": "caesar",
                    "text": "🔼🐍🍋🐱🐱🐶 🐶🐋 🕐?",
                    "shift": 3
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmojiCipherPlaygroundResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "EmojiCipherPlaygroundInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "action": {
            "title": "Action",
            "type": "string",
            "enum": [
              "encode",
              "decode"
            ],
            "default": "encode"
          },
          "scheme": {
            "title": "Cipher",
            "type": "string",
            "enum": [
              "substitution",
              "caesar",
              "base-emoji"
            ],
            "default": "substitution"
          },
          "text": {
            "title": "Text",
            "type": "string",
            "maxLength": 5000
          },
          "key": {
            "title": "Key",
            "description": "Substitution: shuffles the emoji alphabet. Base-emoji: optional shuffle of the byte table (empty = standard table). Not used by Caesar.",
            "type": "string",
            "maxLength": 100,
            "default": "emoji"
          },
          "shift": {
            "title": "Caesar shift",
            "description": "Letters move by this many places (mod 26), digits too (mod 10).",
            "type": "integer",
            "minimum": -100,
            "maximum": 100,
            "default": 3
          }
        },
        "required": [
          "text"
        ]
      },
      "EmojiCipherPlaygroundResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "action",
              "scheme",
              "output",
              "inputLength",
              "outputLength",
              "roundTrip",
              "alphabet",
              "topSymbols",
              "keySpaceBits"
            ],
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "encode",
                  "decode"
                ]
              },
              "scheme": {
                "type": "string",
                "enum": [
                  "substitution",
                  "caesar",
                  "base-emoji"
                ]
              },
              "output": {
                "type": "string"
              },
              "inputLength": {
                "type": "integer",
                "description": "Unicode code points."
              },
              "outputLength": {
                "type": "integer",
                "description": "Unicode code points."
              },
              "roundTrip": {
                "type": "boolean",
                "description": "Encode: decoding the output gives back the input exactly. Decode: encoding the output gives back the input (ignoring emoji variation selectors)."
              },
              "alphabet": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "plain",
                    "emoji"
                  ],
                  "properties": {
                    "plain": {
                      "type": "string"
                    },
                    "emoji": {
                      "type": "string"
                    }
                  }
                }
              },
              "topSymbols": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "symbol",
                    "count"
                  ],
                  "properties": {
                    "symbol": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    }
                  }
                }
              },
              "keySpaceBits": {
                "type": "number",
                "description": "log2 of the number of possible keys — large or not, frequency analysis breaks these ciphers."
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}