Skip to main content
Glama

run_lua

Execute Lua code inside REAPER to complete multi-step automation in one call, return values, and get line-specific errors; set a timeout for slow tasks.

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) is for slow work; REAPER is frozen meanwhile, so start long host commands in the background (io.popen('cmd > log 2>&1 &')) and poll instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
timeoutNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.5.0
    • addedInput schema / properties / timeout
      Added value: +{
      +  "maximum": 600,
      +  "minimum": 1,
      +  "type": "number"
      +}
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does well: it discloses that REAPER is frozen during execution, the timeout default (10) and ceiling (600), that errors carry the failing line, and a concrete io.popen background-and-poll workaround. It stops short of stating that arbitrary code runs with full host privileges and can mutate or destroy project state, which is the main omission for a code-execution tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four tight sentences with no filler, and the most load-bearing facts (what it runs, how to return a value, when to prefer it) are front-loaded before the timeout and freezing caveats.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema and no annotations, yet the description covers the return channel, error reporting shape, execution blocking behavior, timeout bounds, and an escape hatch for long operations. That is essentially everything an agent needs to invoke this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it largely does: it explains that `code` runs with `reaper` in scope and that `return` emits a value, and it spells out `timeout` semantics (seconds, default 10, max 600, intended for slow work). It doesn't say what return types serialize cleanly or name the `code` parameter explicitly, so it isn't exhaustive.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('Run a Lua snippet inside REAPER') and immediately scopes the environment ('reaper in scope') and result channel ('Use return to send a value'). The clause 'Best for multi-step work that would otherwise be many round-trips' distinguishes it from single-call siblings like reaper_call and action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear selection rule: use for multi-step work that would otherwise require many round-trips, implying single operations should use the narrower sibling tools. It also prescribes a pattern for slow work (launch in background and poll) and states the timeout's intended use. No explicit 'do not use for X' exclusion is given, which keeps it below a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.