Skip to main content
Glama

scene_add_button

Destructive

Adds a clickable on-screen interaction button to a copied save and returns its control group index so pressing its key raises the whenUiControlGroupIsTriggered event in the player template graph.

Instructions

Put an interaction button (交互按钮) on the screen in a copy of a save: a round button the player clicks (or presses with its key), at any time and anywhere, unlike an option tab that needs the character next to something. Pressing it raises whenUiControlGroupIsTriggered in a graph on the player template (scene_add_graph attachToPrefab "player"); evt.eventSourceEntity is the player that pressed, and evt.uiControlGroupIndex is the controlGroupIndex this tool returns for the button. position is [x, y] from the screen centre on a 1600 x 900 canvas, y up; size [width, height]; key is the number key that presses it (1 by default: give each button its own). On a computer the button is pressed with its key, which is shown under it: the mouse cursor belongs to the camera during play. The button has the editor's default settings otherwise (no cooldown, no use limit, the default icon, a question mark); with key 1 the three records written are byte for byte those of the button in the official sample 界面控件. Verified in play on 2026-10-11 (examples/buttons): two buttons, keys 1 and 2, each raised the event with its own index, on an account of 奇匠 level 1. Writes a new .gil in the workspace; the official save is not touched.

Input Schema

NameRequiredDescriptionDefault
keyNo
nameYes
sizeNo
mapPathNo
positionNo
outputNameNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With annotations already declaring destructiveHint=true, the description adds rich context beyond them: it writes a new .gil in the workspace without touching the official save, discloses the defaults applied (no cooldown, no use limit, default icon, question mark), names the event raised (whenUiControlGroupIsTriggered) and its evt fields, and warns that each button needs its own key.

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

Conciseness4/5

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

Front-loaded with the core action, then organized into event mechanism, coordinate semantics, defaults, and verification. It is dense and slightly long, but nearly every sentence adds a fact an agent would otherwise get wrong; minor redundancy around the key/coordinate explanations.

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?

No output schema exists, and the description fills that gap by explaining the file output, the raised event, and its evt fields. For a 6-param mutation tool it is nearly complete, with the only shortfall being the undocumented mapPath and outputName params.

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

Parameters4/5

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

Schema description coverage is 0%, so the description carries the burden and does so well for the most consequential params: position is [x,y] from screen centre on a 1600x900 canvas with y up, size is [width,height], and key is the number key that presses it (default 1, and should be unique per button). It leaves mapPath and outputName undocumented in both schema and description, so it does not fully compensate.

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

Purpose5/5

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

States a specific verb and resource ('Put an interaction button on the screen in a copy of a save') and immediately differentiates the concept from an option tab. The distinction from sibling widgets (progress bar, text box, client UI) is implicit through the event/behavior description, so an agent can identify it without opening a schema.

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?

Gives clear context for when this is the right widget: a round button the player clicks 'at any time and anywhere, unlike an option tab that needs the character next to something.' This is a useful use-case contrast. It does not name sibling tools as alternatives or give explicit exclusions, which keeps it below a 5.

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