Skip to main content
Glama

cocos_add_dialog_modal

Add a centered modal dialog with backdrop, title, body, and customizable buttons to Cocos Creator scenes, inheriting UI theme colors and reducing multiple primitive calls to one.

Instructions

Build a centered modal dialog: backdrop + panel + title + body + buttons.

One call replaces 15+ primitive calls. Inherits colors from the project's UI theme (set via cocos_set_ui_theme).

buttons: list of {"text": str, "variant": ..., "click_events": [...]?} where variant is "primary" / "secondary" / "danger" / "ghost" (surface-colored for cancel). Defaults to one primary "OK" button.

Returns all created node + component IDs so the caller can wire click handlers or modify individual parts later.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scene_pathYes
parent_node_idYes
titleYes
bodyNo
buttonsNo
widthNo
heightNo
backdrop_alphaNo
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behaviors: it creates UI elements (implies mutation), returns IDs for later modification, inherits colors from theme, and provides default button behavior. It doesn't mention permissions, error handling, or rate limits, but covers the essential creation and return mechanics.

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?

The description is efficiently structured with three paragraphs: purpose and efficiency gain, theme inheritance and button details, and return value. Every sentence adds value without redundancy, and key information is front-loaded.

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?

For a complex UI creation tool with 8 parameters, 0% schema coverage, no annotations, and no output schema, the description does well by explaining the tool's purpose, parameter semantics, and return value. It could improve by mentioning error cases or prerequisites, but it covers the essential context for correct usage.

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

Parameters5/5

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

With 0% schema description coverage and 8 parameters, the description adds significant value beyond the schema. It explains the 'buttons' parameter structure in detail (including variants like 'primary', 'secondary', 'danger', 'ghost'), mentions default values for buttons and body, and clarifies that colors inherit from theme, which helps interpret parameters like scene_path and parent_node_id in context.

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?

The description clearly states the tool builds a centered modal dialog with specific components (backdrop, panel, title, body, buttons) and distinguishes it from siblings by noting it replaces 15+ primitive calls. It provides a specific verb ('Build') and resource ('centered modal dialog').

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?

The description provides clear context for when to use this tool (to create modal dialogs efficiently) and mentions inheritance from UI theme set via another tool, but does not explicitly state when not to use it or name specific alternatives among the many sibling tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chenShengBiao/cocos-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server