t1k:cocos:playable:parameter-mcp
| Field | Value |
|---|---|
| Module | playable |
| Version | 0.5.6 |
| Effort | medium |
| Tools | — |
Keywords: assign, batch, cocos-creator, editor, mcp, uuid
How to invoke
Section titled “How to invoke”/t1k:cocos:playable:parameter-mcp[assign|batch-set|health]Cocos Playable Parameter MCP
Section titled “Cocos Playable Parameter MCP”Editor bridge for assigning scene nodes to generated parameter @property references. Process-oriented; agnostic to the parameter shape produced by the implement step (works for both top-level entries and grouped containers).
Decision Tree
Section titled “Decision Tree”| Intent | Action |
|---|---|
| ”Assign scene nodes to my parameters” | Batch MCP assignment workflow |
| ”Check if MCP is connected” | Health check + diagnostics |
| ”Batch set component properties” | manage_component set_properties_batch |
MCP Endpoint
Section titled “MCP Endpoint”- URL:
http://127.0.0.1:3000/mcp - Health:
curl -s http://127.0.0.1:3000/health - Requires Cocos Creator Editor to be open with MCP server enabled.
Windows Compatibility
Section titled “Windows Compatibility”- Single-line
curlonly. No\continuations. - Use
$TEMP(or%TEMP%) not/tmp/. - Escape JSON carefully for PowerShell/Bash. For multi-line bodies, write to a temp file and pass
-d @path.
Assignment Workflow
Section titled “Assignment Workflow”Step 1: Read ParameterController.ts → enumerate @property declarationsStep 2: Match each @property name to a scene node by name / path / fuzzyStep 3: Batch call manage_component set_properties_batch for the controller's component, one property entry per @propertyStep 4: Save sceneStep 5: Verify assignments via manage_component get_allOptimized 3-Call Pattern
Section titled “Optimized 3-Call Pattern”# 1. Find ParameterController node UUIDmcp: manage_node find "ParameterController"-> { "uuid": "abc123...", "name": "ParameterController", "path": "Canvas/ParameterController" }
# 2. Batch set ALL @property references in one callmcp: manage_component set_properties_batch { "nodeUuid": "abc123...", "componentType": "<ParameterController type hash>", "properties": [ {"property": "mainCamera", "propertyType": "node", "value": "<camera-uuid>"}, {"property": "ctaButtonSprite", "propertyType": "component", "value": "<sprite-uuid>"}, {"property": "titleLabel", "propertyType": "component", "value": "<label-uuid>"}, {"property": "endCardRootNode", "propertyType": "node", "value": "<node-uuid>"} ]}
# 3. Save scenemcp: manage_scene saveUUID Matching Algorithm
Section titled “UUID Matching Algorithm”| Order | Match | Example |
|---|---|---|
| 1 | Exact name match | @property ctaButton → node named ctaButton |
| 2 | Path suffix match | Canvas/UI/Btn_CTA matches Btn_CTA |
| 3 | Strip type-suffix + fuzzy | ctaButtonSprite → strip Sprite → match ctaButton |
| 4 | Levenshtein on node name | Last resort |
Ambiguous matches → escalate to user via AskUserQuestion.
Property Container Pattern (OPTIONAL Project Convention)
Section titled “Property Container Pattern (OPTIONAL Project Convention)”When the controller uses property containers (@property({ type: SomeContainerClass, group: 'Some Group' })) to organize references by screen, the MCP assignment still operates on the controller node — the container is an in-component nested type, not a separate node. Assign each container’s inner fields by path:
mcp: manage_component set_properties_batch { "nodeUuid": "<controller-uuid>", "componentType": "<ParameterController type hash>", "properties": [ {"property": "endCard.bgSprite", "propertyType": "component", "value": "<sprite-uuid>"}, {"property": "endCard.titleLabel", "propertyType": "component", "value": "<label-uuid>"}, {"property": "endCard.continueButton", "propertyType": "node", "value": "<node-uuid>"} ]}If the MCP doesn’t support dotted-path property keys, fall back to per-field set_property calls in a loop.
attach_script Verification (CRITICAL — avoid duplicate components)
Section titled “attach_script Verification (CRITICAL — avoid duplicate components)”attach_script frequently reports FAIL for user scripts even when the attach actually succeeded. The false negative happens because manage_component get_all lists components by their script cid, not by class name — so a post-attach lookup by class name finds nothing and the tool concludes failure.
Do NOT retry on a reported FAIL. Each retry attaches another copy → duplicate components on the node.
Verify the attach succeeded by one of these instead:
manage_node get_infoand look for a component whose name isnode<ClassName>(the editor’s display form for a user script component), OR- match on the script cid returned by
get_allrather than the class name.
Compilation gotcha: a newly added component class only compiles — and therefore only becomes attachable / resolvable — when the Cocos Creator editor window is focused. If a freshly created script class isn’t found, focus the editor to trigger compilation before re-checking (still do NOT re-issue attach_script).
Fallback: Direct Scene JSON Edit
Section titled “Fallback: Direct Scene JSON Edit”If MCP tools are unavailable, edit the scene file directly:
- Parse
MainScene.sceneJSON array. - Find
ParameterControllercomponent by type hash. - Find target node IDs from the scan report’s
nodes[].uuid(or__id__in the scene JSON). - Update null properties to
{ "__id__": targetNodeId }. - Check
cc.TargetOverrideInfoentries before reporting any property as null (perreferences/scene-json-resolution.mdin the parent skill). - Save the scene file.
References
Section titled “References”references/mcp-patterns.md—curltemplates and batchingreferences/windows-compatibility.md— Platform-specific quirksreferences/retry-logic.md— MCP failure handling- Parent skill
references/mcp-assignment.md— MCP node→property assignment patterns - Parent skill
references/discovery-helpers.md§ Scene JSON Property Resolution —TargetOverrideInforules
Gotchas
Section titled “Gotchas”- MCP must be running in Cocos Editor before any assignment.
- Windows
curldoes not support multi-line JSON bodies easily — use temp files. - Node UUIDs change when scenes are re-saved. Re-run assignment after scene edits.
- Batch size: keep under 20 properties per
set_properties_batchcall to avoid MCP timeouts. @property(Sprite)vs@property(Node): the MCPpropertyTypemust match. Usecomponentfor typed component refs (@property(Sprite),@property(Label)); usenodefor@property(Node).- Property containers do NOT change the host node — assignments still target the controller node, just with dotted-path or per-field property names.
attach_scriptFAIL is usually a false negative — never retry it (each retry adds a duplicate component). Verify viaget_infonamenode<ClassName>or the script cid. New component classes only compile when the editor window is focused. See the “attach_script Verification” section above.