Add an ArkUIBuilder widget to the project
add_widgetCopies a catalog widget's component file into your HarmonyOS module and adds its import to a target .ets page, returning the build() call to paste. Set overwrite to replace an existing file.
Instructions
Copies a widget's component into /src/main/ets/components/.ets and adds its import to target_file. Returns the call to place in build(). Never overwrites a different existing file unless overwrite is true.
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": {
"name": "<name>",
"target_file": "<target_file>"
},
"name": "add_widget"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Component name, id or title | |
| overwrite | No | Replace an existing, different components/<Name>.ets (default false) | |
| target_file | Yes | Absolute path of the .ets page that will use it, inside <module>/src/main/ets (may not exist yet) |