Skip to main content
Glama

cocos_hex_to_rgba

Convert hex color codes to RGBA integer values for Cocos Creator game development, eliminating manual translation errors when using CSS or design tool colors.

Instructions

Convert #rrggbb / #rgb / #rrggbbaa to RGBA ints.

Returns {r, g, b, a} suitable for any tool that takes color_r/color_g/color_b/color_a params. Lets the caller paste CSS / design-tool hex codes without hand-translating to int quadruples (a common source of off-by-one color bugs).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hex_colorYes
alphaNo
Behavior4/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 the return format ('Returns {r, g, b, a}') and the tool's purpose as a safe conversion utility (implied non-destructive, read-only). However, it doesn't mention error handling for invalid hex codes or performance considerations, leaving some behavioral aspects unspecified.

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 front-loaded with the core purpose, followed by return format and usage context. Every sentence adds value: the first defines the conversion, the second specifies output, and the third explains the use case. No wasted words, and it's appropriately sized for a simple utility tool.

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 simple conversion tool with 2 parameters, 0% schema coverage, no output schema, and no annotations, the description is largely complete. It covers purpose, usage, output format, and parameter context. The main gap is lack of explicit error handling details, but given the tool's simplicity, this is a minor omission.

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 must compensate. It explains the 'hex_color' parameter by listing supported formats ('#rrggbb / #rgb / #rrggbbaa') and hints at 'alpha' by mentioning RGBA output, though it doesn't explicitly describe the 'alpha' parameter's role or default. This adds significant value 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 clearly states the specific action ('Convert') and resource ('#rrggbb / #rgb / #rrggbbaa to RGBA ints'), distinguishing it from sibling tools which are all about adding components, managing scenes, or other operations unrelated to color format conversion. It precisely defines the transformation being performed.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'Lets the caller paste CSS / design-tool hex codes without hand-translating to int quadruples (a common source of off-by-one color bugs).' It provides a clear use case and distinguishes it from manual alternatives, though it doesn't name specific sibling alternatives since none are color-related.

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