Skip to content

What are Open Capabilities?

Open Capabilities are a set of host functions the platform injects into code blocks. A code block uses these functions to request explicitly allowed operations on the chat page, instead of accessing the chat page directly.

All Open Capability functions can only be called from inside a code block. The capabilities currently available are listed below, each with its own tutorial:

FunctionPurposeTutorialTavern Helper Compatibility
setChatInput(text, option?)Fill the Roleplay or Direct input boxsetChatInput: Filling the Chat Input/setinput (triggerSlash)
setChatMessages(updates, option?)Switch greeting versionssetChatMessages: Switching GreetingsSame-name function

Open Capabilities will keep expanding — more functions are on the way.

Calling & Error Handling

Every Open Capability function returns a Promise: it resolves on success, and rejects when validation fails, the operation fails, or it times out (10 seconds). You don't need to assemble postMessage payloads yourself — just call the function.

Detect each capability individually and always handle Promise rejections:

js
if (typeof window.setChatInput === 'function') {
  try {
    await window.setChatInput('Text to fill in');
  } catch (error) {
    console.error(error.message);
  }
}

Tips

  • Run a capability check before calling, and always handle Promise rejections
  • For how to write code blocks, how they display, and runtime restrictions, see What are Code Blocks?