Skip to main content
Glama

cocos_build

Build Cocos Creator projects headlessly for platforms like web, mobile, and desktop, with options for source maps, cache busting, and post-build patching to preserve customizations.

Instructions

Headlessly build the project via CocosCreator --build.

Common platforms: web-mobile, web-desktop, wechatgame, ios, android, mac, windows

Convenience booleans for the most-tweaked release flags:

  • source_maps: emit .map files for stack-trace symbolication

  • md5_cache: append md5 hashes to asset filenames (cache busting)

  • skip_compress_texture: skip texture compression (faster iteration)

  • inline_enum: inline enum members to integer literals (smaller JS)

  • mangle_properties: minify property names (breaks reflection APIs)

Pass None on any boolean to let Cocos's own default apply. For flags without an explicit param, use build_options={"flagName": value} — explicit params still win on conflict.

After a successful build, automatically applies any patches registered via cocos_register_post_build_patch to the output directory — so edits to files Cocos regenerates (style.css, project.config.json, etc.) survive every rebuild. Set apply_patches=False to skip that step.

Returns {exit_code, success, duration_sec, log_tail, build_dir, artifacts, plus error_code/hint on failure, post_build_patches dict when patches ran}. First build is slow (~1-2 min); subsequent builds with clean_temp=False are much faster.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
platformNoweb-mobile
debugNo
creator_versionNo
clean_tempNo
source_mapsNo
md5_cacheNo
skip_compress_textureNo
inline_enumNo
mangle_propertiesNo
build_optionsNo
apply_patchesNo
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 key behavioral traits: it's a headless build operation, applies post-build patches automatically (unless disabled), returns detailed results including exit codes and logs, and notes performance characteristics (first build is slow, subsequent builds faster with `clean_temp=False`). It does not cover error handling or permissions in depth, but provides substantial context.

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 well-structured, with clear sections for platforms, flags, parameter behavior, and output. It is front-loaded with the core purpose. Some sentences could be slightly tightened (e.g., the note on `None` defaults is verbose), but overall it earns its place with useful information.

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 (12 parameters, no annotations, no output schema), the description is largely complete. It explains the tool's purpose, parameter semantics, behavioral traits, and output structure. It could benefit from more explicit error handling details or prerequisites, but covers most critical aspects for a build tool.

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?

Schema description coverage is 0%, so the description must compensate. It adds significant meaning beyond the schema: explains common platforms, details the purpose of boolean flags (e.g., `source_maps` for stack traces), clarifies that `None` uses defaults, describes how `build_options` works for unspecified flags, and explains the effect of `apply_patches`. This fully compensates for the lack of schema descriptions.

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: 'Headlessly build the project via `CocosCreator --build`.' It specifies the verb ('build') and resource ('project'), and distinguishes itself from sibling tools (which are mostly about adding components, managing scenes, or previewing) by focusing on the build process.

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 (e.g., for building projects to various platforms, with release flags and post-build patches). It mentions an alternative for unspecified flags ('use `build_options`'), but does not explicitly state when NOT to use it or compare it to other build-related siblings (none are listed).

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