script_patch
Replace an exact substring in a .gd script with a new string. Replaces all occurrences if replace_all is true; otherwise fails on multiple or zero matches.
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.
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 | |||