reaper_execute_lua
Run custom ReaScript Lua code inside REAPER for tasks the built-in tools do not cover. Captures print output and groups edits into a single undo step unless read-only.
Instructions
Run arbitrary ReaScript Lua inside REAPER for anything the other tools don't cover. Runs as a single undo step unless read_only. print() output is captured and returned.
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": {
"code": "<code>"
},
"name": "reaper_execute_lua"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Lua 5.4 ReaScript code; `reaper` API is available, `return` a value to get it back | |
| read_only | No | True for code that only reads; skips the undo point |