Skip to main content
Glama
roblox-studio
by nardjay

Edit script text

edit_script

Apply exact literal string replacements inside a Roblox Studio script, failing safely when the target text is missing to prevent silent corruption.

Instructions

Apply an exact literal string replacement inside a script. Fails if find is missing, so a bad edit cannot silently corrupt the file. Set all=true to replace every occurrence, otherwise the occurrence must be unique unless occurrence (1-based) is given.

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>",
      "find": "<find>",
      "replace": "<replace>"
    },
    "name": "edit_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
allNoReplace every occurrence. Default false.
findYesExact literal text to find (not a pattern).
pathYesInstance path. Accepts "Workspace.Model.Part", "game.Workspace.Model.Part" or "game.Workspace[\"My Part\"].Model". Use "game" or omit for the DataModel root.
replaceYesReplacement text.
occurrenceNoWhich 1-based occurrence to replace when all=false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations only cover the safety profile (readOnly=false, destructive=false, idempotent=false), and the description adds genuinely new behavior: it fails loudly when find is absent, and it enforces occurrence uniqueness unless occurrence is supplied. That failure-mode and uniqueness contract is exactly what an agent needs before mutating a file. It does not describe success output or what happens to file state on partial application.

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, then the failure guarantee, then the disambiguation rule for all vs occurrence. No filler, no restatement of the tool name.

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?

For a five-parameter mutating tool with no output schema and full schema coverage, the description supplies the essential preconditions: exact-literal matching, hard failure on no match, and occurrence/all precedence. Only the success response and any size or encoding limits are unaddressed, which are minor for this complexity.

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 all five parameters are documented in the schema, setting the baseline at 3. The description does add real cross-parameter meaning the schema lacks — that all=false requires a unique match unless occurrence is given — but path and replace semantics are left entirely to the schema.

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

Purpose4/5

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

States a specific verb and resource: 'Apply an exact literal string replacement inside a script.' The word 'literal' plus 'exact' clearly frames it as a surgical text edit rather than a full rewrite, which implicitly distinguishes it from set_script_source. It does not name that sibling, so it stops short of a 5.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: the failure-on-missing-find behavior and uniqueness requirement telegraph that this is the safe choice for small targeted edits. There is no explicit 'use this instead of set_script_source when...' guidance, leaving the agent to infer the boundary.

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