Skip to main content
Glama
aea91
by aea91

Add an ArkUIBuilder widget to the project

add_widget
Idempotent

Copies 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesComponent name, id or title
overwriteNoReplace an existing, different components/<Name>.ets (default false)
target_fileYesAbsolute path of the .ets page that will use it, inside <module>/src/main/ets (may not exist yet)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare openWorldHint, idempotentHint, and non-destructive; the description goes further by disclosing concrete side effects (file written to a specific path, import injected into target_file) and the overwrite guard, which is exactly the kind of behavior an agent needs to know. It does not cover failure modes or permission requirements, so it falls short of exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences, front-loaded with the core action, followed by the return value and the destructive-behavior caveat. No filler or restated name/title.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description usefully states what is returned (the call to place in build()), and annotations cover the safety profile, so an agent has enough to invoke it correctly. The only gap is where the widget component source comes from and what happens on failure, which is minor for a 3-parameter tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents name, overwrite, and target_file, making 3 the baseline. The description reinforces overwrite semantics ('Never overwrites a different existing file unless overwrite is true') but adds no format or constraint detail beyond what the schema already gives.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb (copies/adds import) and concrete destination (<module>/src/main/ets/components/<Name>.ets plus target_file), so the operation is unmistakable. It does not name the siblings search_widgets or get_widget, but the add-vs-read distinction is implicit and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is only implied: an agent infers this is the tool to call when it has a widget name and wants it wired into a page, and 'Returns the call to place in build()' hints at the workflow step. No explicit when-to-use, when-not-to-use, or alternative (e.g., versus search_widgets/get_widget) is stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools