Skip to main content
Glama

cocos_register_post_build_patch

Register patches to automatically modify build files after each successful Cocos Creator build, preserving customizations that would otherwise be overwritten.

Instructions

Register declarative patches that auto-apply after every successful build.

Use when a customization has no Cocos source-config switch and would otherwise get wiped on the next cocos_build (classic examples: style.css body background, project.config.json fields WeChat wants beyond what builder.json exposes, custom index.html overrides).

Each patch dict needs:

platform: str — "web-mobile" / "wechatgame" / "ios" / etc. file: str — path relative to build/<platform>/ (no absolute paths, no '..' segments). kind: one of: - "json_set" + path (dotted key) + value - "regex_sub" + find (regex) + replace (str) - "copy_from" + source (project-relative path to src file)

mode: "append" (default) adds to existing list, "replace" overwrites. To clear all patches, pass patches=[] with "replace".

All patches are validated at register time — invalid regex or unsafe path fails here, not at build time.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYes
patchesYes
modeNoappend
Behavior4/5

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

With no annotations provided, the description carries full burden. It effectively discloses key behavioral traits: patches auto-apply after successful builds, validation happens at registration time (not build time), and it explains the 'mode' parameter behavior ('append' vs 'replace', including how to clear patches). It doesn't mention error handling or side effects beyond validation, but covers the core mutation behavior well.

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: first sentence states the core purpose, second provides usage context, then details parameters with clear formatting. Every sentence adds value—no redundancy or fluff. It's appropriately sized for a complex tool with multiple parameter details.

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 (3 parameters, 0% schema coverage, no output schema, no annotations), the description is largely complete. It explains what the tool does, when to use it, parameter details, and behavioral aspects. The main gap is lack of output information (what happens after registration), but otherwise it provides sufficient context for effective use.

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 fully compensate. It comprehensively documents all three parameters: 'project_path' is implied through context, 'patches' is detailed with structure (platform, file, kind with subtypes and required fields), and 'mode' is explained with default and options. The description 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 tool's purpose: 'Register declarative patches that auto-apply after every successful build.' It specifies the verb ('register'), resource ('patches'), and timing ('after every successful build'). It also distinguishes from siblings by explaining when to use it versus other build/customization tools.

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 guidelines: 'Use when a customization has no Cocos source-config switch and would otherwise get wiped on the next ``cocos_build``.' It gives concrete examples (style.css, project.config.json, index.html) and distinguishes from alternatives by implying this is for post-build patching when other configuration methods are insufficient.

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