run_lua
Execute Lua snippets inside REAPER to automate multi-step tasks in one call, with optional timeout and returned values.
Instructions
Run a Lua snippet inside REAPER (reaper in scope). Use return to send a value. Best for multi-step work that would otherwise be many round-trips. Errors carry the failing line. timeout (seconds, default 10, max 600): a snippet still running Lua after it is stopped with an error (what it did until then stays done); a call blocked inside REAPER (ExecProcess, a render, a dialog) can't be stopped. REAPER is frozen while it runs, so start long host commands in the background (io.popen('cmd > log 2>&1 &')) and poll instead.
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": "run_lua"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout | No |