script_attach
Attach a GDScript to any node in the Godot scene tree, replacing its existing script. Undoable to revert changes easily.
Instructions
Attach a script to a node in the scene tree.
Replaces any existing script on the node. Undoable.
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>",
"script_path": "<script_path>"
},
"name": "script_attach"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Scene path of the node (e.g. "/Main/Player"). | |
| session_id | No | Optional Godot session to target. Empty = active session. | |
| script_path | Yes | res:// path of the .gd (e.g. "res://scripts/player.gd"). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||