Skip to main content
Glama

cocos_generate_asset

Generate AI images and import them as game assets directly into Cocos Creator projects, automating background removal and sprite-frame creation.

Instructions

Generate a game asset via AI and import it into the project in one step.

Built-in AI image generation (no external dependencies):

  • 智谱 CogView-3-Flash (free) — set ZHIPU_API_KEY in cocos-mcp/.env

  • Pollinations Flux (free, no key) — use provider="pollinations"

Flow: AI generate PNG → remove white background → write sprite-frame meta. Config: create .env file in cocos-mcp/ root with ZHIPU_API_KEY=your_key

Example: result = cocos_generate_asset(project, "cute yellow cartoon bird", "bird", style="icon") cocos_add_sprite(scene, node, sprite_frame_uuid=result["sprite_frame_uuid"])

Styles: icon, pixel, character, tile, ui, portrait, item, scene, none.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
promptYes
nameYes
styleNoicon
widthNo
heightNo
providerNozhipu
transparentNo
as_resourceNo
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: it discloses the multi-step flow (generate PNG → remove background → write meta), mentions authentication needs (ZHIPU_API_KEY), and notes free providers. However, it doesn't cover rate limits, error handling, or output format details beyond the example's 'sprite_frame_uuid'.

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 well-structured and front-loaded with the core purpose. Every sentence adds value: setup details, flow explanation, example, and style list. It could be slightly more concise by integrating the style list into the example, but overall it's efficient with minimal waste.

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 tool's complexity (AI generation + import), 9 parameters, no annotations, and no output schema, the description does well: it covers purpose, setup, flow, example, and styles. However, it lacks details on output structure beyond the example's 'sprite_frame_uuid', and doesn't explain all parameters fully (e.g., 'as_resource').

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 9 parameters, the description compensates excellently: it explains 'project', 'prompt', 'name', 'style' (with list), 'provider' (with options), and implies 'transparent' via background removal. It doesn't cover 'width', 'height', or 'as_resource', but provides substantial context for most parameters.

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's purpose: 'Generate a game asset via AI and import it into the project in one step.' It specifies the verb ('generate'), resource ('game asset'), and distinguishes from siblings by focusing on AI generation and import, unlike other tools that add existing assets or components.

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 provides explicit usage guidance: it explains when to use (for AI-generated assets), mentions built-in providers with setup instructions, and includes an example showing how to integrate the result with sibling tool 'cocos_add_sprite'. It also lists available styles to guide parameter selection.

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