script_patch
Replace exact text in a GDScript file and reload it to apply changes. Requires a unique match unless replace_all is set; fails if no match is found.
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 | |||