startLine/endLine range support for manage_scripts get_source (+ warning when params don't apply to the chosen action)
Back to boardFeature request:
### What problem does this solve?
Environment (where we observed all of the below):
- MCP server v2.11.0, Studio plugin v2.11.0, Roblox Studio 0.730.0.7300791
- AI client: Claude Code, driving a live production place (~105 scripts)
Problem 1 — no way to read a line range of a script:
The manage_scripts tool schema documents startLine/endLine as "Used by:
edit_replace, edit_delete" only. The read action get_source has no range
parameters, so it always returns the FULL script source.
In practice, AI-driven editing is line-based in both directions: the
typical loop is "read lines N..M -> edit_replace lines N..M -> re-read
lines N..M to verify". The write half of that loop is already line-based
(edit_replace / edit_delete / edit_insert all take line numbers), but the
read half can only fetch whole files. Concrete numbers from our project:
- Several of our core modules are four-digit line counts (measured in
this place: 2,101 / 1,810 / 1,394 / 1,181 lines).
- A get_source call on one service module - 1,637 lines / 78,785
characters at the time of the call - was issued with startLine=1614,
endLine=1760 (a ~150-line window) and returned the complete 78,785-
character source. The result exceeded the inline size limit of the AI
client and was diverted to an on-disk tool-results file, which the
client then has to re-read in chunks - extra roundtrips and full-file
token cost for what was meant to be a 150-line read.
- Every verification read after a line edit pays the same full-file cost.
Problem 2 — inapplicable parameters are silently ignored:
Passing startLine/endLine to get_source is accepted without any error,
warning, or echo. Minimal reproduction (v2.11.0, empty 10-line
ModuleScript):
Request: action=get_source, path=<script>, startLine=3, endLine=5
Response: lineCount=10, source=<all 10 lines>
(no warning, no indication the range was not applied)
Because the response gives no signal that the parameters were ignored, we
initially mistook this documented behavior for a range bug and nearly
filed an incorrect bug report. The API currently cannot tell the caller
"you passed parameters that this action does not use".
### Proposed solution
1) Add optional startLine/endLine support to get_source:
- Same semantics as the existing edit actions: 1-based, inclusive.
- When a range is given, return only those lines as `source`.
- Response should echo what was applied so the caller can trust it,
e.g.:
{
"lineCount": 1637, // total lines of the script (as today)
"startLine": 1614, // applied range (only when requested)
"endLine": 1760,
"source": "<lines 1614-1760>"
}
- Out-of-range handling: clamp to [1, lineCount] (mirroring how the
edit actions treat line bounds) and echo the clamped values.
- No breaking change: omitting both parameters keeps today's
full-source behavior.
2) Add a warnings field for inapplicable parameters (all manage_* tools):
- If a request contains parameters that the chosen action does not
consume, include them in the response, e.g.:
"warnings": ["startLine/endLine are not used by action 'get_source'"]
- This makes the API self-explaining for AI clients and prevents
silent-ignore misdiagnoses like ours.
### Which tier would this apply to?
Both
### Additional context
Basic (and therefore both tiers):
- get_source is a Basic action today; the range parameters should stay
Basic so the read/edit loop is line-based end to end on the same tier
as edit_replace/edit_delete.
- Note: Pro users currently have a partial workaround (execute_luau with
string.split(script.Source, "\n") slicing), but execute_luau is
PRO-only - Basic users have no way at all to read a line range today.
Basic-tier range support closes that gap.
- The warnings field (proposal 2) is tier-independent API hygiene.