script_patch
Edit GDScript .gd files by replacing an exact unique text anchor with new text, optionally all matches, and reload the loaded Godot script so next calls run updated code.
Instructions
Anchor-based string-replace edit on a .gd file.
Finds an exact old_text and replaces with new_text. Fails
on multiple matches unless replace_all=True; fails on zero matches.
Exact byte match (whitespace significant). Triggers filesystem scan and
refreshes an already-loaded GDScript in place so the next call runs the
new code (response reloaded=true; otherwise reload_reason says why).
Not undoable via Ctrl+Z.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | res:// path ending in .gd. | |
| new_text | Yes | Replacement (empty deletes). | |
| old_text | Yes | Exact substring to find. Must be unique unless replace_all. | |
| session_id | No | Optional Godot session to target. Empty = active session. | |
| replace_all | No | Replace every occurrence. Default False. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||