cocos_add_sprite
Attach a sprite component to a Cocos Creator node using a sprite frame UUID, configure size mode, and apply color tinting or theme presets for visual customization.
Instructions
Attach a cc.Sprite to a node.
sprite_frame_uuid is the <uuid>@f9941 form returned by
cocos_add_image or cocos_get_sprite_frame_uuid.
size_mode: 0=CUSTOM (use UITransform's contentSize), 1=TRIMMED, 2=RAW.
color_preset: pick from the project's UI theme (e.g. "primary",
"surface") to tint the sprite — overrides the explicit RGBA args.
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": {
"scene_path": "<scene_path>",
"node_id": "<node_id>"
},
"name": "cocos_add_sprite"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| node_id | Yes | ||
| sprite_frame_uuid | No | ||
| size_mode | No | ||
| color_r | No | ||
| color_g | No | ||
| color_b | No | ||
| color_a | No | ||
| color_preset | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |