cocos-mcp-server
v0.1.0MCP server for Cocos Creator 3.8 LTS (requires the cocos-mcp editor extension)
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
editor_status Editor status
Report Cocos Creator connection status: editor version, project, access mode and bridge health.
editor_capabilities Editor capabilities
List editor packages/messages discovered by the Phase 0 message inventory plus the scene-script methods available.
| Parameter | Type | Description |
|---|---|---|
filter | string | Case-insensitive substring filter on package or message names. |
includeMessages | boolean | Include every message name per package (can be large). |
editor_inventory Message inventory
Read the local Phase 0 message inventory (~/.cocos-mcp/messages.json) written by the editor extension via cocos-mcp:dump-messages.
| Parameter | Type | Description |
|---|---|---|
includeMethods | boolean | |
limit | integer | |
query | string | Case-insensitive substring match on package or message name. |
editor_raw_query Raw editor query
Call any editor message. Read-only messages work in every mode; destructive messages (delete/apply/revert/publish/…) are refused with CONFIRMATION_REQUIRED — call again with the returned confirmationToken to proceed. Use for Phase 0 API verification and for messages without a dedicated tool.
| Parameter | Type | Description |
|---|---|---|
message * | string | Message name, e.g. "query-assets". |
package * | string | Editor package name, e.g. "asset-db". |
args | array | Positional arguments. |
confirmationToken | string | Token from a previous CONFIRMATION_REQUIRED response. Must be replayed with identical package/message/args. |
bridge_set_mode Set access mode
Change how much the AI may do: "read-only" (reads only), "safe-write" (default; destructive calls need confirmation), "full" (unrestricted). Prefer leaving it at safe-write.
| Parameter | Type | Description |
|---|---|---|
mode * | string |
bridge_audit Read audit log
Return the most recent bridge calls (tool, arguments preview, duration, confirmation) from ~/.cocos-mcp/audit.log.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
onlyDestructive | boolean | |
onlyFailures | boolean |
extension_reload Reload the bridge extension
Ask the editor to reload the cocos-mcp extension, then VERIFY that it actually happened by comparing the bridge capabilities before and after. Cocos Creator 3.8.8 has no working package-reload API, so this usually returns reloaded:false — in that case the editor must be restarted to pick up a new dist/. WARNING: a reload discards unsaved scene changes; call scene_save first.
| Parameter | Type | Description |
|---|---|---|
timeoutSec | integer | How long to watch for the reload to take effect. |
extension_reload_check Check whether the bridge extension can reload itself
Ask the bridge whether the editor exposes a package-reload API. Returns ok:false with the available Editor.Package surface on Cocos Creator 3.8.8, in which case a reload must be done from the Extension Manager.
editor_focus_node Focus the scene camera on a node
Frame one or more nodes in the Scene view so a screenshot actually shows them — the "look at this node" half of the visual feedback loop. Accepts uuid, path or name (ambiguity is rejected). Omit `node` to focus the current selection. Purely a view change: it does not touch the scene, does not dirty it, and is not undoable.
| Parameter | Type | Description |
|---|---|---|
node | string | Node uuid, path ("Canvas/Player") or name. Omit to focus the selection. |
nodes | array | Additional node references to frame together with `node`. |
editor_view_mode Read or change the Scene view 2D/3D mode
Read or change the Scene view 2D/3D mode. In 3D (perspective) a flat 2D layout such as a Canvas looks skewed, which makes screenshots hard to judge; 2D gives a clean top-down view. With no arguments it only reports the current mode. This is editor state — it does not modify the scene or its dirty flag.
| Parameter | Type | Description |
|---|---|---|
mode | string | "query" only reports; "2d"/"3d" switches the Scene view. |
editor_grid Show, hide or query the editor grid
Show, hide or query the Scene view grid. The grid adds visual noise to screenshots, so hide it before visual inspection; omit `visible` to only read the current state.
| Parameter | Type | Description |
|---|---|---|
visible | boolean | true/false to set, omit to query the current state. |
editor_open_panel Open the cocos-mcp panel
Open the extension status panel in the editor (bridge port, mode, token preview, connected clients, audit tail). Useful to hand control back to the user.
scene_get_tree Get scene tree
Read the active scene hierarchy from the engine runtime. Returns node names, paths, transforms and component class names. Editor scaffolding (grid, gizmos, editor camera) is excluded by default. For UUIDs use scene_get_editor_tree.
| Parameter | Type | Description |
|---|---|---|
depth | integer | Maximum depth below each root child. |
includeEditorNodes | boolean | Include editor-only nodes (Editor Scene Foreground/Background, grid, gizmos, editor camera). |
maxNodes | integer | Maximum number of nodes returned. |
scene_get_stats Scene statistics
Summarize the active scene: user node count, component counts, engine version and frame count. Editor scaffolding counts are reported separately so an empty scene does not look heavy.
| Parameter | Type | Description |
|---|---|---|
includeEditorNodes | boolean | Merge editor node/component counts into the main totals. |
scene_find_nodes Find nodes
Find nodes in the active scene by name substring, exact path, or component class name. Editor scaffolding is excluded by default.
| Parameter | Type | Description |
|---|---|---|
component | string | Component class name substring, e.g. "Sprite". |
includeEditorNodes | boolean | Include editor-only nodes in the results. |
maxResults | integer | |
name | string | Case-insensitive name substring. |
path | string | Exact hierarchy path relative to the scene root, e.g. "Canvas/Player". |
scene_get_node Get node detail
Read one node by path, name or uuid, including transform, component list and simple component properties. Accepts a uuid, which is the only way to read one of several nodes that share a path. On failure the error lists the paths that do exist, so a stale path is self-correcting.
| Parameter | Type | Description |
|---|---|---|
node | string | Node uuid, path or unique name. Prefer this over `path`. |
path | string | Hierarchy path, e.g. "Canvas/Player". |
scene_get_info Get scene info
Basic information about the active scene (name, node count, engine version).
scene_get_editor_tree Get editor node tree (with UUIDs)
Read the hierarchy from the editor itself. Unlike scene_get_tree (engine runtime), every node and component includes its UUID, which is required by write operations. Prefer this tool when you plan to modify the scene.
| Parameter | Type | Description |
|---|---|---|
includeComponents | boolean | Keep component entries (type + value uuid) per node. |
maxDepth | integer | Trim the returned tree to this depth (editor returns the whole tree). |
scene_get_current Get current scene state
Active scene UUID, dirty flag and ready state. Use the UUID with scene_open or to correlate editor events.
node_create Create node
Create an empty node under a parent. `parent` accepts a node path ("Canvas"), a node name, or a uuid; omit it to create at the scene root. Returns the new node uuid. Nodes are created on the DEFAULT layer unless `layer` is given — UI nodes under a Canvas normally need UI_2D (33554432).
| Parameter | Type | Description |
|---|---|---|
name * | string | New node name. |
dryRun | boolean | Return the exact editor call instead of executing it. |
layer | integer | Layer bitmask for the new node. Use 33554432 (UI_2D) for UI nodes, 1073741824 (DEFAULT) for 3D. |
parent | string | Parent node path, name or uuid. Omit — or pass "scene"/"/" — for the scene root. |
node_delete Delete node (destructive)
Delete one or more nodes by path/name/uuid. This is destructive: in safe-write mode it returns CONFIRMATION_REQUIRED with a token that must be replayed with identical arguments via editor_raw_query, or by calling this tool again with the token.
| Parameter | Type | Description |
|---|---|---|
confirmationToken | string | Token from a previous CONFIRMATION_REQUIRED response. |
dryRun | boolean | Return the exact editor call instead of executing it. |
node | string | Single node path, name or uuid. |
nodes | array | Multiple node references. |
node_duplicate Duplicate nodes
Duplicate one or more nodes (copy with a new uuid).
| Parameter | Type | Description |
|---|---|---|
dryRun | boolean | Return the exact editor call instead of executing it. |
node | string | Single node path, name or uuid. |
nodes | array | Multiple node references. |
node_move Move / reparent nodes
Reparent one or more nodes under a new parent. `parent` accepts a path, name or uuid. Use "scene" to move to the scene root.
| Parameter | Type | Description |
|---|---|---|
parent * | string | New parent path/name/uuid, or "scene" for the scene root. |
dryRun | boolean | Return the exact editor call instead of executing it. |
node | string | Single node path, name or uuid. |
nodes | array | Multiple node references. |
node_rename Rename node
Rename a node by path/name/uuid.
| Parameter | Type | Description |
|---|---|---|
name * | string | New node name. |
node * | string | Node path, name or uuid. |
dryRun | boolean | Return the exact editor call instead of executing it. |
node_set_active Set node active
Activate or deactivate a node (equivalent to the Inspector checkbox).
| Parameter | Type | Description |
|---|---|---|
active * | boolean | |
node * | string | Node path, name or uuid. |
dryRun | boolean | Return the exact editor call instead of executing it. |
node_set_transform Set node transform
Set position, euler rotation and/or scale of a node. Omitted fields are left untouched. Rotation is in degrees (euler angles), matching the Inspector.
| Parameter | Type | Description |
|---|---|---|
node * | string | Node path, name or uuid. |
dryRun | boolean | Return the exact editor call instead of executing it. |
position | object | |
rotation | object | Euler angles in degrees. |
scale | object |
node_set_layer Set node layer
Set the node integer layer bitmask (e.g. 1073741824 = DEFAULT, 33554432 = UI_2D).
| Parameter | Type | Description |
|---|---|---|
layer * | integer | Layer bitmask value. |
node * | string | Node path, name or uuid. |
dryRun | boolean | Return the exact editor call instead of executing it. |
node_set_property Set node property
Set an arbitrary node-level property using the Inspector property name (e.g. "mobility"). The value type is read from the editor dump, so nested vector properties work too.
| Parameter | Type | Description |
|---|---|---|
node * | string | Node path, name or uuid. |
property * | string | Node property name, e.g. "mobility". |
value * | New value (JSON). | |
dryRun | boolean | Return the exact editor call instead of executing it. |
component_types List component class names
List every class the editor knows (scene.query-classes), filtered by an optional substring. Use it to discover a valid class name before calling component_add, or to recover from an INVALID_PROPERTY error.
| Parameter | Type | Description |
|---|---|---|
filter | string | Case-insensitive substring, e.g. "sprite", "label", "physics". |
limit | integer | |
refresh | boolean | Ignore the 60s cache and re-query the editor. |
component_get Get component (editor dump)
Read a component exactly as the Inspector sees it (types, defaults, enums), unlike scene_get_node which reads simple values from the engine runtime.
| Parameter | Type | Description |
|---|---|---|
node * | string | Node path, name or uuid. |
component | string | Component class name (e.g. "Sprite") or component uuid. Defaults to the first component. |
component_add Add component
Add a component to a node by class name, e.g. "cc.Sprite" or "cc.UITransform". Idempotent: if the node already has that component the tool returns alreadyPresent instead of asking the editor to add a duplicate (Cocos logs "Can't add component ... already contains the same component"). Note: creating a node under a UI hierarchy (Canvas) makes the editor add cc.UITransform automatically, so adding it again is unnecessary. Set allowDuplicate: true only for components that support multiple instances (e.g. colliders).
| Parameter | Type | Description |
|---|---|---|
component * | string | Component class name, e.g. "cc.Sprite". |
node * | string | Node path, name or uuid. |
allowDuplicate | boolean | Attempt to add even when the node already has this component type. |
dryRun | boolean | Return the exact editor call instead of executing it. |
component_remove Remove component (destructive)
Remove a component from a node. Destructive: needs a confirmation token in safe-write mode.
| Parameter | Type | Description |
|---|---|---|
component * | string | Component class name (e.g. "Sprite") or component uuid. |
node * | string | Node path, name or uuid. |
confirmationToken | string | Token from a previous CONFIRMATION_REQUIRED response. |
dryRun | boolean | Return the exact editor call instead of executing it. |
component_set_property Set component property
Set one component property using the Inspector property name (e.g. "string", "color", "enabled"). The property type is read from the editor dump so the correct serialized form is sent. Asset references accept a uuid.
| Parameter | Type | Description |
|---|---|---|
component * | string | Component class name (e.g. "Sprite") or component uuid. |
node * | string | Node path, name or uuid. |
property * | string | Property name, e.g. "string" or "enabled". |
value * | New value (JSON). | |
dryRun | boolean | Return the exact editor call instead of executing it. |
component_call_method Call component method
Invoke a method on a component (as the Inspector does for preview buttons). Arguments are passed as JSON.
| Parameter | Type | Description |
|---|---|---|
component * | string | Component class name or component uuid. |
method * | string | Method name. |
node * | string | Node path, name or uuid. |
args | array |
scene_check_ui_setup Check UI rendering setup
Diagnose why 2D/UI nodes might be invisible. Verified on Cocos Creator 3.8.8: creating a Canvas + Sprite through messages produces a working hierarchy that still renders nothing, because (a) new nodes default to the DEFAULT layer, and (b) the default Main Camera visibility mask EXCLUDES UI_2D. Run this after building UI with node_create/component_add.
scene_save Save scene
Save the active scene to disk and report the resulting dirty flag. Every MCP write is undoable (Ctrl+Z) and marks the scene dirty, so save only when the user agrees.
| Parameter | Type | Description |
|---|---|---|
dryRun | boolean | Return the exact editor call instead of executing it. |
scene_undo Undo
Undo the last scene edit.
scene_redo Redo
Redo the last undone scene edit.
scene_align_node Align nodes inside their parent
Place one or more nodes against an edge of their parent's content box. Unlike node_set_transform this does the layout maths for you: it reads the parent anchor + contentSize and the child anchor, so a "right edge with 20px margin" lands exactly on the right edge regardless of anchor settings. Accepts uuid, path or unique name; a uuid is required when several nodes share a path.
| Parameter | Type | Description |
|---|---|---|
align | string | Edge of the parent to align to. "center"/"middle" centre the node; the rest inset from that edge. |
margin | number | Inset in pixels from the parent edge. Ignored by center/middle. |
node | string | Node uuid, path ("Canvas/Player") or unique name. |
nodes | array | Additional nodes to align the same way. |
editor_get_selection Read the current editor selection
Node uuids currently selected in the editor. Cocos Creator 3.8.8 exposes no query message for the selection, so this is tracked from the `selection:select`/`selection:unselect` broadcasts: `observed: false` means the user has not changed the selection since the bridge started, so the selection is unknown rather than empty.
scene_call_method Call an allowlisted engine method (opt-in)
Call one of the extension's scene-script methods directly, e.g. "getStats" or "findNodes" with options no dedicated tool exposes. Requires `full` access mode because these run inside the engine and bypass the editor's own validation. Arbitrary JavaScript is deliberately NOT supported — only the fixed method allowlist. Use bridge_capabilities to see the exact list.
| Parameter | Type | Description |
|---|---|---|
method * | string | Scene method name, e.g. "getStats". |
args | array | Positional arguments. Most methods take a single options object. |
particle_presets List particle presets
Named 2D particle configurations built from cc.ParticleSystem2D properties (no .plist asset needed). Use the name with particle_create.
particle_create Create a 2D particle effect
Add cc.ParticleSystem2D to a node and configure it from a preset plus overrides, using custom-mode properties (no .plist needed). `spriteFrame` is REQUIRED to be visible — Cocos draws particles with a sprite frame, and the component ships with an empty one, so a particle system without it looks like nothing happened. Every written property is verified by readback.
| Parameter | Type | Description |
|---|---|---|
node * | string | Node path, name or uuid to attach the effect to. |
dryRun | boolean | Return the property writes instead of executing them. |
playOnLoad | boolean | Start emitting when the scene runs. |
preset | string | Preset name from particle_presets (fire, smoke, sparkle, explosion, snow). |
properties | object | Extra cc.ParticleSystem2D properties, e.g. {"totalParticles": 300}. |
spriteFrame | string | db:// url or uuid of an image to use as the particle texture. Defaults to the built-in db://internal/default_ui/atom.png. |
animation_create_clip Create an animation clip asset
Create a cc.AnimationClip (.anim) from the editor's own template shape, optionally with keyframe curves. Times are normalized 0..1 inside the clip. Supported animated properties: position, scale, eulerAngles (vectors) and opacity (number). The clip is imported through AssetDB and read back to confirm the editor kept the curves.
| Parameter | Type | Description |
|---|---|---|
url * | string | Target db://assets/... URL ending in .anim. |
dryRun | boolean | |
duration | number | Clip length in seconds. |
name | string | Clip name (defaults to the file name). |
sample | integer | Sample rate (fps). |
tracks | array | Curves to write. Omit for an empty clip. |
wrapMode | string | Playback wrap mode. |
animation_assign Attach animation clips to a node
Add cc.Animation to a node and assign clips + defaultClip + playOnLoad. Assigning the clips array is verified by readback: Cocos Creator 3.8.8 applies asset-reference array writes and then raises an internal error, so a naive tool would report failure for a write that worked.
| Parameter | Type | Description |
|---|---|---|
clips * | array | .anim db:// urls or uuids, in order. |
node * | string | Node path, name or uuid. |
defaultClip | string | Which clip to play by default (defaults to the first). |
dryRun | boolean | |
playOnLoad | boolean | Play the default clip when the scene starts. |
animation_info Inspect animation clips on a node or in the project
Read the cc.Animation setup on a node (clips, defaultClip, playOnLoad) or list .anim assets in the project. Use it to confirm what animation_assign produced.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
node | string | Node path, name or uuid to inspect. |
pattern | string | AssetDB glob used when `node` is omitted. |
asset_search Search assets
Search project assets via AssetDB. Returns uuid, url, type and path.
| Parameter | Type | Description |
|---|---|---|
pattern * | string | Glob/substring pattern, e.g. "**/*.prefab" or "Player". |
limit | integer | |
type | string | Optional asset type filter, e.g. "cc.Prefab", "cc.SceneAsset". |
asset_get_info Get asset info
Read AssetDB metadata for one asset by uuid or db URL.
| Parameter | Type | Description |
|---|---|---|
uuid * | string | Asset uuid or db:// URL. |
asset_dependencies Asset dependencies
List dependency assets for one asset uuid.
| Parameter | Type | Description |
|---|---|---|
uuid * | string | Asset uuid or db:// URL. |
asset_create Create asset
Create a text asset (script, JSON, effect, …) or folder through AssetDB so the .meta file is generated correctly. Never write asset files directly to disk. Pass content: null to create a folder.
| Parameter | Type | Description |
|---|---|---|
url * | string | Target url, e.g. "db://assets/scripts/Player.ts". |
content | string | null | File contents. Use null to create a folder. |
dryRun | boolean | Return the exact editor call instead of executing it. |
overwrite | boolean | Replace an existing file. |
rename | boolean | On conflict, create a uniquely named asset instead of failing. |
asset_read Read asset text
Read the text contents of a project asset (script, JSON, prefab, scene, .meta). Binary assets are rejected. The file is resolved through AssetDB and must live inside the open project.
| Parameter | Type | Description |
|---|---|---|
asset * | string | db:// url or uuid. |
maxBytes | integer |
asset_save Save asset text
Overwrite the text contents of an existing asset through AssetDB (keeps .meta intact and triggers reimport).
| Parameter | Type | Description |
|---|---|---|
asset * | string | db:// url or uuid. |
content * | string | New file contents. |
dryRun | boolean | Return the exact editor call instead of executing it. |
asset_move Move or rename asset
Move or rename an asset or folder. AssetDB rewrites dependent references, so use this instead of moving files on disk. Destructive: needs a confirmation token in safe-write mode.
| Parameter | Type | Description |
|---|---|---|
source * | string | Current db:// url. |
target * | string | New db:// url (file name included). |
confirmationToken | string | Token from a previous CONFIRMATION_REQUIRED response. |
dryRun | boolean | Return the exact editor call instead of executing it. |
overwrite | boolean |
asset_copy Copy asset
Copy an asset or folder to a new url.
| Parameter | Type | Description |
|---|---|---|
source * | string | Source db:// url. |
target * | string | Destination db:// url. |
dryRun | boolean | Return the exact editor call instead of executing it. |
overwrite | boolean |
asset_import Import external file
Import a file from disk into the project. `source` must be an absolute path outside or inside the project; AssetDB copies it and generates the .meta file.
| Parameter | Type | Description |
|---|---|---|
source * | string | Absolute path to the file on disk. |
target * | string | Destination db:// url, e.g. "db://assets/img/hero.png". |
dryRun | boolean | Return the exact editor call instead of executing it. |
overwrite | boolean | |
rename | boolean |
asset_delete Delete asset (destructive)
Delete an asset or folder through AssetDB. Destructive: in safe-write mode the first call returns CONFIRMATION_REQUIRED with a token that must be replayed with identical arguments.
| Parameter | Type | Description |
|---|---|---|
asset * | string | db:// url (or uuid) to delete. |
confirmationToken | string | Token from a previous CONFIRMATION_REQUIRED response. |
dryRun | boolean | Return the exact editor call instead of executing it. |
asset_refresh Refresh asset
Refresh one asset from disk (use after editing files outside the editor).
| Parameter | Type | Description |
|---|---|---|
asset * | string | db:// url or uuid. |
dryRun | boolean | Return the exact editor call instead of executing it. |
reimport | boolean | Use reimport-asset instead of refresh-asset to force re-import. |
asset_open Open asset in editor
Open an asset in its editor (scene, prefab, script, …). Equivalent to double-clicking it in the Assets panel.
| Parameter | Type | Description |
|---|---|---|
asset * | string | db:// url or uuid. |
asset_meta_get Read asset .meta
Return the parsed .meta JSON for an asset (importer settings, uuid, sub-assets).
| Parameter | Type | Description |
|---|---|---|
asset * | string | db:// url or uuid. |
asset_meta_save Save asset .meta
Write .meta JSON for an asset. The uuid must be preserved unless you intentionally want to break references.
| Parameter | Type | Description |
|---|---|---|
asset * | string | db:// url or uuid. |
meta * | Meta JSON. | |
dryRun | boolean | Return the exact editor call instead of executing it. |
script_create Create script
Create a TypeScript Component from the editor template (the same result as Assets → Create → TypeScript). Fills the ccclass placeholders with a PascalCase class name. Does not overwrite existing files unless overwrite is true.
| Parameter | Type | Description |
|---|---|---|
name * | string | File name without extension, e.g. "PlayerController" or "player_controller". |
className | string | Override the generated class name (defaults to PascalCase of `name`). |
dryRun | boolean | Return the exact editor call instead of executing it. |
folder | string | Destination folder url, e.g. "db://assets/scripts". |
overwrite | boolean |
asset_types List creatable asset types
List the entries of the Assets panel "Create" menu (script, scene, prefab, material, …) together with their file name and template url.
prefab_create Create prefab from node
Save a scene node as a prefab asset and return the new asset. Verified live on Cocos Creator 3.8.8: the message signature is positional — scene.create-prefab(nodeUuid, prefabUrl) — and it returns the prefab asset uuid.
| Parameter | Type | Description |
|---|---|---|
node * | string | Node path, name or uuid. |
url * | string | Destination url, e.g. "db://assets/prefabs/Enemy.prefab". |
dryRun | boolean | Return the exact editor call instead of executing it. |
prefab_instantiate Instantiate prefab
Insert a prefab asset into the scene under a parent. Cocos Creator 3.8.8 has no public scene message for this (drag & drop uses an internal channel), so it runs through the extension scene script with the engine API (assetManager.loadAny + instantiate). Requires the extension build that ships instantiatePrefab.
| Parameter | Type | Description |
|---|---|---|
prefab * | string | Prefab db:// url or asset uuid. |
dryRun | boolean | Return the exact editor call instead of executing it. |
name | string | Override the instance name. |
parent | string | Parent node path. Omit — or pass "scene"/"/" — for the scene root. |
build_platforms List build platforms
All platform ids this editor can build for, with which ones are native. Use the id in build_run.
build_get_options Get build options
Return the complete, editor-validated build options for a platform (32 fields: buildPath, outputName, scenes, startScene, debug, md5Cache, bundleConfigs, …). Builds reject partial options, so use this to inspect or seed `overrides` for build_run.
| Parameter | Type | Description |
|---|---|---|
overrides | object | Shallow overrides merged on top of the completed options. |
platform | string | Platform id from build_platforms, e.g. "web-mobile". |
build_run Run a build
Start a build as a background job and return its taskId immediately (a web-mobile build takes ~40s, native longer — far beyond the bridge timeout). Poll with build_get_status, or pass wait=true to block until it finishes. The scene must be saved first: unsaved editor changes are NOT included in the build (a warning is returned when the scene is dirty).
| Parameter | Type | Description |
|---|---|---|
overrides | object | Shallow overrides for the completed options, e.g. {"debug": true}. The editor auto-increments outputName on every build (web-mobile → web-mobile-001 → …), so pass {"outputName": "web-mobile"} to… |
platform | string | Platform id from build_platforms, e.g. "web-mobile". |
timeoutSec | integer | Maximum time to wait when wait=true. |
wait | boolean | Block until the build finishes instead of returning immediately. |
build_get_status Get build status
State of one build task (state/progress/stage/message/detailMessage), or of the newest task when taskId is omitted. States: processing, success, failure.
| Parameter | Type | Description |
|---|---|---|
includeOptions | boolean | Include the full options object used for the build. |
taskId | string | Task id from build_run. Omit for the newest task. |
build_history Build history
Recent build tasks, newest first. Use it to check whether anything is still running before starting another build.
| Parameter | Type | Description |
|---|---|---|
limit | integer |
build_cancel Cancel a build
Interrupt a running build task. Targets the newest processing task when taskId is omitted. The task ends as state "failure" with message "The build task was interrupted", and the editor leaves a partial (often empty) output directory behind.
| Parameter | Type | Description |
|---|---|---|
taskId | string | Task id from build_run. Omit to cancel the running task. |
build_clear_tasks Remove a build task
Remove one task from the builder task list (does not delete build output). Destructive: the first call returns CONFIRMATION_REQUIRED with a token — replay with confirmationToken.
| Parameter | Type | Description |
|---|---|---|
taskId * | string | Task id from build_history. |
confirmationToken | string | Token from a previous CONFIRMATION_REQUIRED response. |
preview_get_status Preview server status
Preview URL, LAN IP, whether the server actually answers over HTTP, and how many game clients are connected. `connectedClients` is NOT a liveness signal — a running preview with no browser open reports 0, so `serving` comes from a real HTTP probe.
| Parameter | Type | Description |
|---|---|---|
open | boolean | Also ensure the preview server is running (preview.open). |
probe | boolean | HTTP-probe the preview URL to prove the server is up. |
preview_open Open preview
Start (or focus) the preview server so the game can be opened in a browser or on a device. Returns the preview URL. The scene must be saved beforehand — preview loads from disk.
project_config_groups List project settings groups
Config groups editable through project_get_config / project_set_config (project, engine, asset-db, builder, engine-extends), with their settings tabs.
project_get_config Read project settings
Read a project/engine/asset-db/builder setting. Without `path` the whole config group is returned; with a dotted path only that value (e.g. general.designResolution.width → 1280, general.designResolution, layer, sorting-layer).
| Parameter | Type | Description |
|---|---|---|
group | string | |
path | string | Dotted path inside the group, e.g. "general.designResolution.width". |
project_set_config Write project settings
Write one project/engine/builder setting by dotted path and verify it took effect. Cheap and non-destructive but project-wide: it changes what every scene and build uses (e.g. general.designResolution.width changes the canvas design size). Read the current value first with project_get_config.
| Parameter | Type | Description |
|---|---|---|
path * | string | Dotted path inside the group, e.g. "general.designResolution.width". |
value * | New value (JSON). Must match the type the editor expects for that path. | |
group | string |
editor_windows List editor windows
Enumerate the editor Electron windows (id, title, visible, bounds). Cocos Creator 3.8 runs its whole UI in ONE window (`main.html`) — the Scene view is a panel inside it, so screenshots include the full editor unless a rect is given.
editor_screenshot Screenshot the editor
Capture the editor (Scene view included) as a PNG image the model can look at — the visual feedback loop for "change → look → fix". Use `rect` to crop to just the Scene panel, and `maxWidth` to keep the image small. `scene.snapshot` in Cocos Creator 3.8 is NOT a screenshot (it snapshots scene state for undo), which is why this goes through Electron capturePage.
| Parameter | Type | Description |
|---|---|---|
maxWidth | integer | Downscale to this width (aspect preserved). 0 disables resizing and returns the native size. |
rect | object | Crop rectangle in window pixels, e.g. the Scene panel area. |
windowId | integer | Window id from editor_windows. Defaults to the main editor window. |
events_list List forwarded editor events
Names of Cocos Creator broadcasts this bridge forwards (scene, asset, build, programming).
events_recent Recent editor events
Read buffered editor broadcasts (scene ready/close, asset add/change/delete, builder task changes, script build end). Useful to detect what changed since your last call.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
name | string | Case-insensitive substring filter, e.g. "asset" or "builder". |