Skip to main content
Glama

edit_script_lines

Destructive

Replace a specific range of lines in a Roblox script with new text without resending the full source. Returns the new line count; re-read line numbers before another edit.

Instructions

Replace a range of lines in one script with new text, without resending the whole Source; returns the new line count. Overwrites those lines. Line numbers shift after each edit, so re-read with script_source or grep_scripts before a second edit. When you can quote the text to change, patch_script is safer because it doesn't depend on line numbers.

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": {
      "path": "<path>",
      "startLine": "<startLine>",
      "endLine": "<endLine>",
      "newText": "<newText>"
    },
    "name": "edit_script_lines"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesScript to edit. Dot path from the DataModel root, e.g. "Workspace.Map.Door" or "StarterGui.HUD.Frame". A leading "game." is optional; a duplicate sibling name takes the suffix Tufan prints, e.g. "Part (2)".
placeNoTarget place (PlaceId or project name). Defaults to the bound/sole connected place.
endLineYesLast line to replace, inclusive. Use startLine - 1 to insert before startLine without removing anything.
newTextYesReplacement text; may span several lines. "" deletes the range.
startLineYesFirst line to replace, counting from 1.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv0.1.1
    • changedInput schema / properties / endLine / description
      Previous value: -"last line to replace (inclusive)"New value: +"Last line to replace, inclusive. Use startLine - 1 to insert before startLine without removing anything."
    • addedInput schema / properties / endLine / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / endLine / minimum
      Added value: +-9007199254740991
    • changedInput schema / properties / endLine / type
      Previous value: -"number"New value: +"integer"
    • changedInput schema / properties / newText / description
      Previous value: -"replacement text (multi-line ok; '' deletes the range)"New value: +"Replacement text; may span several lines. \"\" deletes the range."
    • addedInput schema / properties / path / description
      Added value: +"Script to edit. Dot path from the DataModel root, e.g. \"Workspace.Map.Door\" or \"StarterGui.HUD.Frame\". A leading \"game.\" is optional; a duplicate sibling name takes the suffix Tufan prints, e.g. \"Part (2)\"."
    • changedInput schema / properties / startLine / description
      Previous value: -"first line to replace (1-indexed)"New value: +"First line to replace, counting from 1."
    • addedInput schema / properties / startLine / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / startLine / minimum
      Added value: +1
    • changedInput schema / properties / startLine / type
      Previous value: -"number"New value: +"integer"
  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?

Annotations already declare destructiveHint=true, readOnlyHint=false and idempotentHint=false, so the safety profile is covered. The description adds real value beyond that: it warns that line numbers shift after each edit (the practical consequence of non-idempotence) and states the response is the new line count. It stops short of mentioning permissions or failure modes, so not a 5.

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?

Three sentences, front-loaded with the action and the efficiency benefit, then the hazard, then the alternative. Every clause carries actionable information with no restatement of the name or title.

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?

Although there is no output schema, the description states the return value (new line count), the mutation semantics (overwrites), the sequencing hazard, and the safer alternative. For a 5-parameter destructive edit tool, an agent has everything needed to call it correctly or route elsewhere.

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

Parameters3/5

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

Schema description coverage is 100%, and the schema already explains path format, the inclusive endLine semantics, the startLine-1 insertion trick, and that "" deletes the range. The description adds no parameter-level detail beyond that, so the baseline of 3 applies.

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 and resource ('Replace a range of lines in one script with new text') plus the efficiency rationale ('without resending the whole Source') and the return value. It also names patch_script as the alternative, so an agent can distinguish it from siblings without opening schemas.

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

Usage Guidelines5/5

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

Gives explicit when-to-use-this vs when-to-use-another guidance: use patch_script 'when you can quote the text to change' because it doesn't depend on line numbers. It also gives a concrete prerequisite for repeated use — re-read with script_source or grep_scripts before a second edit.

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