Skip to main content
Glama

scene_add_client_template

Destructive

Adds a reusable client UI control template to a copied save so scripts can instantiate dynamic bullets, cards, or list rows at runtime and receive its templateIndex.

Instructions

Add a template of client controls (客户端控件模板) to a copy of a save: one control, with children when it is a container, kept beside the screen. A script makes copies of it at run time (game.InstantiateClientUIControl(templateIndex, parent), game.DestroyClientUIControl(control)): bullets, cards, rows of a list, anything whose number is not known beforehand. A grid of scene_add_client_ui makes its items from one (itemTemplate), a reference shows one (template). template is a control as scene_add_client_ui takes one (its name is the name of the template; a container with children, an image, a preset button with its states, scripts of its own that start with every copy); the result gives its templateIndex for the script. Add the template before the interface that uses it. Writes a new .gil in the workspace. The records are byte for byte those of two templates saved in the editor; not yet seen in play.

Input Schema

NameRequiredDescriptionDefault
mapPathNo
replaceNo
templateYes
outputNameNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare a write operation with destructiveHint=true, and the description adds useful file-level context: it writes a new .gil in the workspace and the records are byte-for-byte copies of editor-saved templates, not yet tested in play. However, it never explains what the replace parameter destroys or overwrites, which is the key destructive behavior an agent needs to know.

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

Conciseness2/5

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

The content is front-loaded but delivered in dense, run-on sentences with interrupting parentheticals (the Chinese term, the runtime API calls, the templateIndex aside). It is difficult to scan and would benefit from shorter sentences or a structured breakdown of parameters and caveats.

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

Completeness3/5

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

For a four-parameter tool with a deeply nested schema and no output schema, the description usefully explains the template concept, runtime instantiation model, and the return templateIndex. It is incomplete regarding the working map/output target and replace semantics, and it does not address destructive behavior despite the annotation.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must carry parameter meaning. It covers the template object fairly well (control kinds, children, name semantics, scripts that start with every copy) and notes the result gives templateIndex, but it says nothing about mapPath, replace, or outputName semantics, leaving three of four top-level parameters undocumented.

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 first sentence states a specific verb and resource: adding a client-control template into a copied save. It also distinguishes the tool from scene_add_client_ui by explaining that grids use a template for itemTemplate and references use one for template. The purpose is clear, though the sentence is tangled enough that an agent must parse it carefully.

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

Usage Guidelines4/5

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

It gives clear usage context: templates are for runtime-spawned items whose count is unknown (bullets, cards, list rows) and must be added before the interface that uses them. It links to scene_add_client_ui via itemTemplate/template usage. It does not state when not to use this tool or name alternative ways to achieve the same effect.

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