Feature request: server-side Luau syntax validation for manage_scripts
Back to board### What problem does this solve?
Environment (where we observed all of the below):
- MCP server v2.11.1, Studio plugin v2.11.1, Roblox Studio 0.730.0.7300791
- AI client: Claude Code, driving a live production place (dozens of
scripts, ~18k lines total; several core modules are four-digit line
counts — e.g. 2,565 / 1,811 / 1,394 lines).
Problem 1 — there is no cheap "does this script even compile?" check.
After an AI writes or edits a script (set_source / edit_replace /
edit_insert / edit_delete), the ONLY way to find out whether the result
parses is to run the whole game via run_test. That is a heavy, slow path
for a question that is purely static: run_test spins up a full playtest,
takes many seconds, and has repeatedly been observed to be able to crash
Studio. Using it as a syntax check is massively over-scoped.
Problem 2 — parse errors surface one-at-a-time and late.
When a script does fail to compile, the failure only shows up at runtime
boot, and typically only the FIRST error in the module is visible. The
practical loop becomes: edit -> run_test -> read first error -> fix ->
run_test again -> next error -> ... Each iteration pays the full
playtest cost. A parser would return every diagnostic in one pass.
Problem 3 — silent write-side corruption is caught far too late.
We have a recurring failure mode where a newline is dropped during a
script write/sync, gluing two statements into one invalid token
(e.g. `end local x` on one line, or a `)` concatenated onto the next
statement). Minimal shape of what lands in the source:
-- intended:
end
local nextThing = compute()
-- what we get:
endlocal nextThing = compute()
The edit tool reports success — the mutation WAS applied — so nothing
signals a problem until a later run_test blows up at boot, often in a
different module than the one we were editing, which makes it expensive
to trace back to the edit that caused it. There is currently no step
between "write the source" and "run the whole game" that could catch
this the moment it happens.
Net effect: every single script edit in an AI-driven workflow carries an
unanswered question — "did I just introduce a parse error / did the
write corrupt the source?" — and the only tool that answers it is the
most expensive and least safe one available.
### Proposed solution
1) Add a `validate` action to manage_scripts:
- Input: path (an existing script) OR raw source string.
- Runs the source through a Luau parser SERVER-SIDE (the MCP server is
Node — a Luau parser such as the official Luau WASM front-end, or a
full-moon-style parser, can validate without needing Studio
loadstring, which is disabled at edit time anyway).
- Returns ALL syntax diagnostics, not just the first, e.g.:
{
"ok": false,
"diagnostics": [
{ "line": 412, "column": 4, "message": "Expected identifier, got 'local'" },
{ "line": 880, "column": 1, "message": "Expected 'end' to close 'function' at line 861" }
]
}
- On clean source: { "ok": true, "diagnostics": [] }.
2) Optional auto-validate on the write actions (set_source / edit_replace
/ edit_insert / edit_delete):
- A `validate: true` flag (or a `validate` mode) that, after applying
the edit, parses the resulting full script source and returns the
same diagnostics field alongside the normal success payload.
- The edit still applies (non-blocking) — the point is to SIGNAL, in
the same response, "this write left the script in a non-parsing
state", instead of the caller discovering it a run_test later.
- This directly neutralizes the blast radius of the newline-glue /
write-corruption failure mode: the corrupting edit reports its own
breakage immediately, in the module that was actually edited.
3) Nice-to-have: if the parser can cheaply report unused-global / obvious
static issues, surface them as warning-level diagnostics too — but the
core ask is pure syntax/parse validation. Type-level analysis is
explicitly NOT required for this to be valuable.
No breaking change: `validate` is a new action; the auto-validate flag is
opt-in and defaults off, so existing edit behavior is unchanged.
### Which tier would this apply to?
Both
### Additional context
Basic (and therefore both tiers):
- The core write/edit actions this pairs with (set_source, edit_replace,
edit_insert, edit_delete, get_source) are all Basic, so a syntax check
belongs on Basic too — it is the natural companion to line-based
editing and is exactly where Basic users, who have no execute_luau
workaround, are most exposed to undetected parse breakage.
- The optional auto-validate flag on the edit actions is likewise Basic.
- If any deeper static-analysis extension (proposal 3) is added later, a
Pro gate on the extended diagnostics would be reasonable; plain
syntax validation should stay Basic.
One quick question: is GitHub here the best place to report bugs and send
feature requests like this one, or would you prefer another channel?
Genuinely: you do great work on this. Thank you.