Skip to main content
Glama

edit_script

Replace exact text in a Roblox Studio script while leaving the rest untouched; fails on missing or ambiguous matches unless replaceAll is enabled.

Instructions

Partially edit a Script/LocalScript/ModuleScript: replaces the exact text old_text with new_text, leaving the rest of the source untouched. Fails if old_text is not found, or matches more than once (unless replaceAll=true). Prefer this over write_script for small changes.

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>",
      "old_text": "<old_text>",
      "new_text": "<new_text>"
    },
    "name": "edit_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesPath to the script
forceNoBypass safety checks (default false)
clientNoTarget a specific Studio client by name (as shown on the panel, e.g. "studio"). Omit to auto-pick: the only active client, or the most recently active one when several are connected.
new_textYesText to put in place of old_text (empty string deletes it)
old_textYesExact existing text to replace (must match the source precisely, including whitespace)
replaceAllNoReplace every occurrence of old_text instead of requiring a single match (default false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full load and does disclose real behavior: the rest of the source is preserved, the call fails on a missing or ambiguous match, and replaceAll relaxes the single-match rule. What it omits is the mutation risk profile — whether the edit is undoable (an undo sibling exists), how the 'force' safety bypass interacts with editing, and what a successful response contains.

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, no filler. The operation and its core semantics come first, then the failure modes, then the sibling routing hint last — a sensible front-loaded order with every clause earning its place.

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

Completeness4/5

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

This is a mutation tool with no annotations and no output schema, so the description must supply the behavioral contract, and it largely does: what is changed, what is preserved, and when the call errors. The remaining gap is the surrounding safety context — reversibility via undo and the role of the force bypass — which an agent would need before editing a live Studio session.

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 coverage is 100%, so every parameter including path, force, client, new_text, old_text and replaceAll is already documented at the field level. The description adds real meaning to old_text and replaceAll by explaining the exact-match and single-occurrence rules that govern failure, but says nothing extra about force or client targeting. That is a modest increment over a fully documented schema, so the baseline 3 holds.

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?

The description opens with a specific verb and resource ('Partially edit a Script/LocalScript/ModuleScript') and immediately defines the mechanism ('replaces the exact text old_text with new_text, leaving the rest of the source untouched'). That 'partial' framing is exactly what separates it from the sibling write_script, so an agent can classify it without opening any schema.

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?

It gives an explicit routing rule: 'Prefer this over write_script for small changes,' naming the alternative and the condition that selects it. It also states the failure conditions that would push an agent to switch approach (no match, or multiple matches without replaceAll). It stops short of saying when write_script is the correct choice instead, but the contrast is easily inferred.

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