{
  "schema_version": "1",
  "generated_at": "2026-04-27",
  "source": "@cryptolect/emdash-plugin",
  "tools": [
    {
      "name": "cryptolect.check_access",
      "description": "Cheap pre-flight: does the supplied bearer token currently have decode access to a given cipher? Use before spending quota on a `cryptolect.decode` call.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Cryptolect bearer token in the `crypt_<tier>_<28-base62>` format issued by `POST /v1/subscriptions/tokens`."
          },
          "cipher_id": {
            "type": "string",
            "description": "Public-facing cipher identifier (e.g., `pub-abc123`)."
          }
        },
        "required": [
          "token",
          "cipher_id"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "tier": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "beta",
              "developer",
              "team",
              "scale",
              "enterprise",
              null
            ],
            "description": "Subscription tier the bearer token belongs to, or null when unknown."
          },
          "quota_remaining": {
            "type": [
              "number",
              "null"
            ]
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable code when `valid=false`: `quota_exceeded`, `cipher_not_granted`, `invalid_token`, etc."
          }
        },
        "required": [
          "valid",
          "tier",
          "quota_remaining",
          "reason"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "cryptolect.decode",
      "description": "Decode a single emojitext payload using the bearer's subscription. Burns one quota unit on success. Returns the upstream wire error code on failure (`cipher_not_granted`, `quota_exceeded`, `decode_failed`, etc.).",
      "inputSchema": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Cryptolect bearer token in the `crypt_<tier>_<28-base62>` format issued by `POST /v1/subscriptions/tokens`."
          },
          "cipher_id": {
            "type": "string",
            "description": "Public-facing cipher identifier (e.g., `pub-abc123`)."
          },
          "encoded_content": {
            "type": "string",
            "description": "Emoji-encoded ciphertext as stored on the gated block."
          }
        },
        "required": [
          "token",
          "cipher_id",
          "encoded_content"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "plaintext": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable wire-error code. See `AGENT_INTERFACE_SPEC.md` §'Stable Error Codes' for the canonical list."
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false,
            "nullable": true
          }
        },
        "required": [
          "success",
          "plaintext",
          "error"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "cryptolect.read_gated_post",
      "description": "Convenience: fetch a published page by URL, walk its Portable Text body for `cryptolectGated` blocks, decode each via the bearer, and return both plaintext and decoded blocks together. Falls back to per-block error envelopes if any individual cipher is not granted.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Cryptolect bearer token in the `crypt_<tier>_<28-base62>` format issued by `POST /v1/subscriptions/tokens`."
          },
          "post_url": {
            "type": "string",
            "description": "Absolute URL of the published page. The plugin re-fetches via `ctx.http.fetch`."
          }
        },
        "required": [
          "token",
          "post_url"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "content": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "plaintext_blocks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ],
                  "additionalProperties": true
                }
              },
              "decoded_blocks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    },
                    "cipher_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "text",
                    "cipher_id"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "plaintext_blocks",
              "decoded_blocks"
            ],
            "additionalProperties": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable wire-error code. See `AGENT_INTERFACE_SPEC.md` §'Stable Error Codes' for the canonical list."
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "additionalProperties": false,
            "nullable": true
          }
        },
        "required": [
          "success",
          "content",
          "error"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "cryptolect.list_accessible_ciphers",
      "description": "List the ciphers the bearer's subscription holds active grants for, plus current quota state. Useful for deciding what gated content is safe to attempt.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "Cryptolect bearer token in the `crypt_<tier>_<28-base62>` format issued by `POST /v1/subscriptions/tokens`."
          }
        },
        "required": [
          "token"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "ciphers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "cipher_id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "publisher_domain": {
                  "type": "string"
                },
                "quota_remaining_for_this_cipher": {
                  "type": "number"
                }
              },
              "required": [
                "cipher_id",
                "label",
                "publisher_domain",
                "quota_remaining_for_this_cipher"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "ciphers"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "cryptolect.get_acquisition_info",
      "description": "Given a cipher the current token does NOT have access to, return acquisition options (subscription tiers, beta-invite URL) so the agent's host code can prompt the human operator.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "cipher_id": {
            "type": "string",
            "description": "Public-facing cipher identifier (e.g., `pub-abc123`)."
          },
          "current_token": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "cipher_id",
          "current_token"
        ],
        "additionalProperties": false
      },
      "outputSchema": {
        "type": "object",
        "properties": {
          "cipher_id": {
            "type": "string"
          },
          "cipher_label": {
            "type": "string"
          },
          "publisher_domain": {
            "type": "string"
          },
          "acquire_options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "`subscription` or `beta_invitation`."
                },
                "tier_options": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "price_usd": {
                        "type": "number"
                      },
                      "quota": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "id",
                      "price_usd",
                      "quota"
                    ],
                    "additionalProperties": false
                  }
                },
                "register_url": {
                  "type": "string"
                },
                "request_access_url": {
                  "type": "string"
                },
                "docs_url": {
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "cipher_id",
          "cipher_label",
          "publisher_domain",
          "acquire_options"
        ],
        "additionalProperties": false
      }
    }
  ]
}
