Docs

Built-in tools›Preview

Run script

preview_eval
Group
Preview
Turned on by
Its own switch on the Tools page of Conversation settings.
Approval
Reviewed: writes and open-ended actions ask for approval unless the security level or an earlier “Always allow” covers them.
Profile key
tool.preview_eval.description

Runs a JavaScript expression in the conversation's preview page and returns its result as JSON.

The model also uses it to navigate, reload, hover and press keys, since no other tool does those. A returned promise is awaited. Changes it makes to the page last only until the next reload.

When it asks you

Asks at Manual and Accept edits, because the script can do anything the page itself can; Always allow is not offered. If you have been using the page yourself, you hand it back first in the pane; on a signed-in page, that takeover needs your approval at every security level. See Browser and preview.

Limits

The call stops waiting for a result after 15 seconds.

Parameters

ParameterTypeDetails
expression required
Expression
stringJavaScript expression to evaluate in the page context. Return values are serialized as JSON.
serverId
Server ID
stringServer ID

Edit this page on GitHub