Read the code and event binding of R3 Code components
r3_code_readRead back what a Code component actually contains — its full JavaScript source and the event it runs on. r3_code_write reports what it wrote; this reports what is there.
Use it before replacing a script, so an edit builds on the real source instead of overwriting it blind, and after a write whose reply you did not see, to confirm what landed. Call it with NO entityRefs to get every Code component in the project — that is how you find a script again when you never received the entityRef for it.
Each script comes back with its codeVersion: pass it as r3_code_write's baseVersion. The event comes back as a NAME (RENDER_BEFORE, KEY_DOWN, …), which is the same form r3_code_write takes, so you can hand it straight back. r3_component_read reports the same field as a raw number and omits any source over 2000 characters; this is the tool for reading code.
A body too large to return is left out WHOLE and reported with its size — never truncated, because a partial script written back would delete the rest of it. An entityRef that does not exist is named and the others are still read.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | The project to read from, from r3_project_create or r3_project_load. | |
| entityRefs | No | Which Code components to read, e.g. ["spin"]. Omit for ALL of them. Up to 50 per call. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| answer | Yes | This answer in words: what was done, what R3 measured, decided or refused, and what to do next. The same text as the result's text block. Read it: the fields beside it are the data, this is the guidance. | |
| projectId | Yes | ||
| components | Yes | ||
| unreadable | Yes | ||
| projectName | Yes |