Replace the script on screen
set_scriptReplaces the whole script of the project open on the user's screen, for a script that is new from the first line. edit_part with project "@session" changes only the lines it names, builds them first and lands on screen the same way. A different part is shown with save_project and open_project; a script sent here lands in the open project, and a save writes it there. The change appears in every window immediately and lands in the editor's normal undo history, so the user can Cmd-Z it back like their own typing; there is no lock. It edits the screen only: nothing is written to disk until the user saves or save_project is called. A script that does not build replaces the user's working part on screen with an error; evaluate_part builds a script without showing it. The script replaces anything the user typed since get_session last returned the text.
The reply waits (up to wait_s, default 20 s) until a window reports evaluating this revision, and its viewers lists each window with the revision it showed and whether it built: with which volume_mm3, or the error it hit. It does not echo the script: script_chars and script_sha256 identify what landed, and get_session returns it whole. Setting the same script again makes every window evaluate it again, which recovers a window that is showing something stale.
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": {
"script": "<script>"
},
"name": "set_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | The DSL source to put on screen, whole — this replaces the open document, it does not append to it. | |
| wait_s | No | How long to wait, in seconds, for a window to report that it evaluated this revision. 0 to 60; defaults to 20. The reply comes as soon as one does, or when the time is up with `viewers` saying where each window got. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| origin | Yes | ||
| script | No | ||
| viewers | Yes | ||
| revision | Yes | ||
| script_chars | Yes | ||
| script_sha256 | Yes | ||
| shown_in_chat | No |