script_patch
Replace exact text in Godot .gd scripts. Finds a specified string and swaps it for new content, supports replace-all for repeated occurrences.
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.
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>",
"old_text": "<old_text>",
"new_text": "<new_text>"
},
"name": "script_patch"
}
}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 | |||