Skip to main content
Glama
roblox-studio
by nardjay

Write script source

set_script_source

Replaces a script's entire source and updates the open Studio editor buffer so changes appear immediately without stale files.

Instructions

Replace the entire Source of a script. Prefer edit_script for small changes: rewriting a file from memory risks losing code you have not read. If the script is open in Studio, the editor buffer is updated through ScriptEditorService so Studio does not show a stale file.

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>",
      "source": "<source>"
    },
    "name": "set_script_source"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesInstance path. Accepts "Workspace.Model.Part", "game.Workspace.Model.Part" or "game.Workspace[\"My Part\"].Model". Use "game" or omit for the DataModel root.
sourceYesComplete new source text.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, but the description adds substantial context beyond them: the full-overwrite semantics, the data-loss risk of reconstructing source from memory, and the side effect that an open Studio editor buffer is refreshed via ScriptEditorService. The only gap is a slight tension with destructiveHint=false, since a whole-source replacement can silently discard unread code; the description flags the risk but the annotation framing is not reconciled.

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 alternative, then the side effect. Every sentence carries distinct information with no restatement of the title or schema.

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 two-parameter write tool with annotations and no output schema, the definition covers what it does, when not to use it, and its Studio side effect. It stops short of saying what happens if path does not resolve to a script instance or whether a nonexistent path errors versus creates, which an agent would benefit from knowing.

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 the accepted path formats and that source is the "Complete new source text." The description reinforces that the whole source must be supplied ("entire Source", "rewriting a file from memory") but adds no syntax or format detail beyond the schema, so baseline 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 the entire Source of a script") and immediately contrasts the scope with edit_script's incremental edits. An agent can distinguish this whole-file overwrite from the sibling edit tool without opening either schema.

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?

Explicitly names the alternative (edit_script) and the condition that selects it ("small changes"), plus a stated risk that motivates the routing ("rewriting a file from memory risks losing code you have not read"). That is a clear when-to-use/when-not-to-use rule rather than implied guidance.

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