attach_script
Attach a script to an entity by creating the script component if missing and adding the named script in one step. Returns updated entity summary.
Instructions
Attach a script to an entity in one step: creates the script component if missing, then adds the named script. This consolidates the common "add script component" + "add script" flow. Returns the updated entity summary. Note: the script must already exist as a parsed script asset (create one with create_assets type="script", set its code with set_script_text, then script_parse). When NOT to use: to write the script's source code (use set_script_text) or to set script attribute values (use modify_entities on components.script.scripts..attributes).
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": {
"id": "<id>",
"scriptName": "<scriptName>"
},
"name": "attach_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Entity ID | |
| index | No | Execution order index | |
| attributes | No | Initial script attribute values | |
| scriptName | Yes | Registered script name to attach |