Skip to main content
Glama

cocos_add_label

Add text labels to Cocos Creator game scenes with customizable styling, overflow handling, and design token presets for consistent UI theming.

Instructions

Attach cc.Label. overflow: 0=NONE 1=CLAMP 2=SHRINK 3=RESIZE_HEIGHT. cache_mode: 0=NONE 1=BITMAP 2=CHAR. CLAMP truncates, SHRINK auto-shrinks font.

Design-token presets (override the equivalent explicit arg):

  • color_preset: e.g. "text", "primary", "danger"

  • size_preset: "title" | "heading" | "body" | "caption"

  • outline_color_preset: e.g. "bg" for dark outline on light Set the theme once via cocos_set_ui_theme; un-themed projects fall back to dark_game defaults so presets always resolve.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scene_pathYes
node_idYes
textYes
font_sizeNo
color_rNo
color_gNo
color_bNo
color_aNo
h_alignNo
v_alignNo
overflowNo
enable_wrapNo
line_heightNo
enable_outlineNo
outline_widthNo
cache_modeNo
color_presetNo
size_presetNo
outline_color_presetNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses some behavioral traits: it explains overflow modes (CLAMP truncates, SHRINK auto-shrinks font) and cache modes, and mentions theme dependency. However, it doesn't cover important aspects like whether this is a creation/mutation operation, what permissions might be needed, error conditions, or what the output contains.

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?

The description is appropriately sized and front-loaded with the core functionality. The first sentence establishes the purpose, followed by parameter explanations and theme context. While dense with information, every sentence serves a clear purpose in explaining tool behavior and usage.

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?

Given the complexity (19 parameters, 0% schema coverage) and the presence of an output schema (which handles return values), the description does a good job covering key aspects. It explains parameter semantics thoroughly and provides important context about theme dependencies. The main gap is lack of behavioral transparency about the operation's nature (creation vs. modification) and potential side effects.

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 for 19 parameters, the description compensates exceptionally well. It explains the semantics of 'overflow' and 'cache_mode' parameters with their numeric codes and behaviors, and provides detailed information about the three preset parameters (color_preset, size_preset, outline_color_preset) including examples and valid values. This adds substantial meaning beyond the bare schema.

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 starts with a specific verb ('Attach') and resource ('cc.Label'), clearly stating what the tool does. It distinguishes from siblings by focusing specifically on label creation/attachment, unlike other tools that add different UI components (buttons, sprites, etc.) or perform different operations (building, previewing).

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 about when to use design-token presets versus explicit arguments, and mentions the prerequisite of setting a theme via 'cocos_set_ui_theme'. However, it doesn't explicitly state when NOT to use this tool 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