Skip to main content
Glama

cocos_create_sprite_atlas

Automatically pack multiple sprite-frame PNGs into a single atlas texture during Cocos Creator builds, eliminating manual enumeration and simplifying game asset management.

Instructions

Create an AutoAtlas bundle (Cocos 3.8 build-time packing).

Drops a <atlas_name>.pac marker + correct meta into a folder (default assets/atlas/<name>/). From that point on, every sprite-frame PNG in that folder is automatically packed into one atlas texture when cocos_build runs — no manual enumeration needed afterward.

png_paths is optional. If provided, the PNGs are copied into the atlas folder + sprite-frame metas are written. For PNGs already in the folder (e.g. cocos_add_image(rel_path= "assets/atlas/<name>/foo.png")), no copy is required; they are picked up at build time automatically.

Tunables (all match Cocos Creator 3.8 defaults):

  • max_width / max_height — atlas texture size cap (1024).

  • padding — gap between frames in px (2).

  • power_of_two — force ^2 sizes; usually off.

  • force_squared — force 1:1 aspect; usually off.

  • filter_unused — drop unreferenced sprite frames from the final bundle.

  • algorithm"MaxRects" (default) or "Basic".

  • quality — 0-100 PNG quality.

Returns {dir, atlas_uuid, pac_path, images, atlas_dir_rel}. atlas_dir_rel is the project-relative folder — drop more PNGs there later to add them to the atlas without running this tool again.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
atlas_nameYes
png_pathsNo
rel_dirNo
max_widthNo
max_heightNo
paddingNo
power_of_twoNo
force_squaredNo
filter_unusedNo
algorithmNoMaxRects
qualityNo
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 explaining key behaviors: it creates files (marker + meta), automatically packs PNGs at build time, copies PNGs if provided, and returns specific data including a reusable folder path. It mentions build-time integration but could elaborate more on error conditions or side effects.

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 well-structured and front-loaded with the core purpose, followed by operational details, parameter explanations, and return values. Every sentence adds value—no wasted words—and it efficiently covers complex functionality in a compact format.

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 tool with 12 parameters, no annotations, and no output schema, the description is highly complete: it explains purpose, usage, parameters, and return values. However, it lacks explicit error handling or permission requirements, and the output schema absence means return value details are only partially covered in the description.

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?

Given 0% schema description coverage for 12 parameters, the description compensates excellently by explaining the optional nature of 'png_paths', listing all tunable parameters with their defaults and purposes (max_width, padding, algorithm, etc.), and clarifying the role of 'rel_dir' through the default folder example. 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 clearly states the tool creates an AutoAtlas bundle for Cocos 3.8 build-time packing, specifying it generates a marker file and metadata. It distinguishes from sibling tools by focusing on sprite atlas creation rather than general asset addition or scene manipulation, with no tautology present.

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 on when to use the tool (for automatic sprite packing at build time) and mentions that PNGs can be added later without re-running the tool. However, it 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