Files
Genarrative/plugins/agc-cocos-editor/src/operations/catalog.json
T
kdletters 4a46f89c9b
Project CI / Repository checks (push) Successful in 2m45s
Project CI / Frontend tests (push) Successful in 3m27s
Project CI / Backend tests (push) Successful in 6m18s
Project CI / Native shell tests (push) Failing after 13m52s
接入 AGC 内置插件宿主并补齐 Cocos 编辑器能力 (#338)
客户端新增随包提供的插件宿主和 Cocos Creator 集成:识别并导入 Cocos 项目,通过内置桥接操作已打开的编辑器,无需安装项目 MCP 扩展。DirectProject 现在公开 36 个独立 cocos_* 工具,保留通用 JavaScript 执行入口。

- 通用插件 SDK、命令/能力/面板注册、编辑器适配器和跨进程内置插件开关。
- Cocos 场景、节点、组件、Prefab、UI、Layout/Widget、资源、保存、撤销、日志与预览调试;目录和实现由 JS/native 共用。
- 编辑事务回读、失败回滚、后续手动修改保护及不确定结果禁止重放;预览截图通过 MCP image 返回。
- DirectProject 跳过无关专业 Agent 历史,将项目打开和历史读取中的同步 I/O 移出窗口线程,消除 Cocos 执行与项目文件锁的错误耦合。

验证:
- 合并 master 后:类型/配置检查、编码检查、Rust 格式检查和提交钩子通过。
- 合并 master 后:Cocos 项目打开、插件面板和开发启动定向测试 10 通过、2 跳过;DirectProject MCP 测试 17 通过、1 项真实 Creator opt-in 忽略;插件宿主测试 9/9。
- 插件行为测试 17/17;native 测试 20/20,4 项 opt-in 测试默认忽略。
- 真实 Creator 3.8.8 的 36/36 操作 smoke,以及客户端 MCP tools/list、tools/call、UI/撤销和预览截图,在功能实现阶段已验证通过;本次 master 合并后未重复真实 GUI smoke。

验证边界:发行安装包和远端 CI 尚未验收。

Reviewed-on: #338
Co-authored-by: kdletters <kdletters@qq.com>
Co-committed-by: kdletters <kdletters@qq.com>
2026-09-13 14:48:55 +08:00

1840 lines
48 KiB
JSON

[
{
"name": "cocos_ping",
"description": "确认客户端内置 Cocos 桥接和场景运行时可达。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_get_capabilities",
"description": "读取内置 Cocos 操作清单、限制、参数和撤销语义。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_get_project_info",
"description": "读取当前绑定项目名称、Creator 版本和工程信息。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_get_current_scene_meta",
"description": "读取当前场景 UUID、名称、资源 URL 和未保存状态。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_get_log_tail",
"description": "有界读取当前项目日志;文件缺失明确返回 missing。",
"inputSchema": {
"type": "object",
"properties": {
"relativePath": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"maxLines": {
"type": "integer",
"minimum": 1,
"maximum": 2000
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_diagnose",
"description": "汇总当前桥接、场景和项目日志的实际诊断证据。",
"inputSchema": {
"type": "object",
"properties": {
"maxLogLines": {
"type": "integer",
"minimum": 1,
"maximum": 2000
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_get_build_diagnostics",
"description": "有界读取项目已有构建日志,提取错误与警告,不启动构建。",
"inputSchema": {
"type": "object",
"properties": {
"maxFiles": {
"type": "integer",
"minimum": 1,
"maximum": 50
},
"maxLinesPerFile": {
"type": "integer",
"minimum": 20,
"maximum": 2000
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_list_assets",
"description": "按 assets 相对目录、扩展名筛选已导入资源,返回 UUID 和 URL。",
"inputSchema": {
"type": "object",
"properties": {
"relativeDir": {
"type": "string",
"maxLength": 512
},
"extensions": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 32
},
"maxItems": 64
},
"maxResults": {
"type": "integer",
"minimum": 1,
"maximum": 2000
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_get_prefab_info",
"description": "读取指定 Prefab 的导入状态、节点和组件摘要。",
"inputSchema": {
"type": "object",
"properties": {
"prefabPath": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": ["prefabPath"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_get_hierarchy",
"description": "读取有界场景树,返回稳定 NID、UUID、组件和父子关系。",
"inputSchema": {
"type": "object",
"properties": {
"maxDepth": {
"type": "integer",
"minimum": 0,
"maximum": 100
},
"maxNodes": {
"type": "integer",
"minimum": 1,
"maximum": 5000
},
"includeInternal": {
"type": "boolean"
},
"includeEditorDecorations": {
"type": "boolean"
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_search_nodes",
"description": "按名称包含和组件类型筛选场景节点。",
"inputSchema": {
"type": "object",
"properties": {
"nameSubstring": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"componentFilter": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"maxResults": {
"type": "integer",
"minimum": 1,
"maximum": 500
},
"includeInternal": {
"type": "boolean"
},
"includeEditorDecorations": {
"type": "boolean"
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_inspect_node",
"description": "读取节点变换及带索引和类型的组件属性。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
}
},
"required": ["nid"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_set_node_active",
"description": "修改节点激活状态并回读,可撤销。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"active": {
"type": "boolean"
}
},
"required": ["nid", "active"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_set_node_transform",
"description": "修改局部位置、欧拉角或缩放并回读。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
},
"rotationEuler": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
},
"scale": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
}
},
"required": ["nid"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_set_node_name",
"description": "重命名节点并回读。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
},
"required": ["nid", "name"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_create_node",
"description": "在指定父节点下创建节点,返回 NID 和 UUID。",
"inputSchema": {
"type": "object",
"properties": {
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
},
"required": ["parentNid", "name"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_delete_node",
"description": "删除节点;必须 confirm:true,有子节点还需 cascade:true;支持 MCP 撤销。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"confirm": {
"const": true
},
"cascade": {
"type": "boolean"
}
},
"required": ["nid", "confirm"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_reparent_node",
"description": "修改父节点,拒绝循环和移动场景根,可保留世界变换。",
"inputSchema": {
"type": "object",
"properties": {
"childNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"keepWorldTransform": {
"type": "boolean"
}
},
"required": ["childNid", "parentNid"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_set_node_sibling_index",
"description": "调整兄弟节点顺序并回读。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"index": {
"type": "integer",
"minimum": 0,
"maximum": 100000
}
},
"required": ["nid", "index"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_duplicate_node",
"description": "复制节点及子树,保留组件,返回新节点身份。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
}
},
"required": ["nid"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_instantiate_prefab",
"description": "通过 AssetDB 解析 assets/...prefab 并在父节点下实例化。",
"inputSchema": {
"type": "object",
"properties": {
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"prefabPath": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": ["parentNid", "prefabPath"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_set_component_property",
"description": "按 inspect 返回的组件索引修改可序列化属性;颜色支持 #RRGGBBAA,资源支持 assets 路径或 UUID,回读验证。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"componentIndex": {
"type": "integer",
"minimum": 0,
"maximum": 1000
},
"property": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"value": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string",
"maxLength": 8192
},
{
"type": "null"
},
{
"type": "object",
"properties": {
"width": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"height": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
}
},
"required": ["width", "height"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"r": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"g": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"b": {
"type": "integer",
"minimum": 0,
"maximum": 255
},
"a": {
"type": "integer",
"minimum": 0,
"maximum": 255
}
},
"required": ["r", "g", "b"],
"additionalProperties": false
}
]
}
},
"required": ["nid", "componentIndex", "property", "value"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_add_component",
"description": "添加内置或已注册组件,返回真实组件索引和 UUID。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"componentType": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
},
"required": ["nid", "componentType"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_remove_component",
"description": "删除组件;可传预期类型防止索引漂移。",
"inputSchema": {
"type": "object",
"properties": {
"nid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"componentIndex": {
"type": "integer",
"minimum": 0,
"maximum": 1000
},
"expectedComponentType": {
"type": "string",
"minLength": 1,
"maxLength": 128
}
},
"required": ["nid", "componentIndex"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_create_ui_shape",
"description": "创建持久可见的圆/方/圆角矩形,配置 Sprite,验证并可整步撤销。",
"inputSchema": {
"type": "object",
"properties": {
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
},
"size": {
"type": "object",
"properties": {
"width": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
},
"height": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
}
},
"required": ["width", "height"],
"additionalProperties": false
},
"widget": {
"type": "object",
"properties": {
"top": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"bottom": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"left": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"right": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"horizontalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"verticalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": [],
"additionalProperties": false
},
"save": {
"type": "boolean"
},
"shape": {
"type": "string",
"enum": ["circle", "rectangle", "rounded-rectangle"]
},
"color": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
}
},
"required": ["parentNid"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_create_ui_label",
"description": "创建并配置 Label 文字、字体、颜色和对齐,验证并可撤销。",
"inputSchema": {
"type": "object",
"properties": {
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
},
"size": {
"type": "object",
"properties": {
"width": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
},
"height": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
}
},
"required": ["width", "height"],
"additionalProperties": false
},
"widget": {
"type": "object",
"properties": {
"top": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"bottom": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"left": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"right": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"horizontalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"verticalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": [],
"additionalProperties": false
},
"save": {
"type": "boolean"
},
"text": {
"type": "string",
"maxLength": 8192
},
"color": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
},
"fontSize": {
"type": "number",
"minimum": 1,
"maximum": 1024
},
"lineHeight": {
"type": "number",
"minimum": 1,
"maximum": 2048
},
"horizontalAlign": {
"type": "string",
"enum": ["left", "center", "right"]
},
"verticalAlign": {
"type": "string",
"enum": ["top", "center", "bottom"]
}
},
"required": ["parentNid", "text"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_create_ui_sprite",
"description": "从 assets 图片创建 Sprite,支持九宫格与颜色。",
"inputSchema": {
"type": "object",
"properties": {
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
},
"size": {
"type": "object",
"properties": {
"width": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
},
"height": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
}
},
"required": ["width", "height"],
"additionalProperties": false
},
"widget": {
"type": "object",
"properties": {
"top": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"bottom": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"left": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"right": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"horizontalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"verticalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": [],
"additionalProperties": false
},
"save": {
"type": "boolean"
},
"assetPath": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"color": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
},
"nineSlice": {
"type": "boolean"
}
},
"required": ["parentNid", "assetPath"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_create_ui_button",
"description": "创建可见背景、Button 组件和居中文字子节点,整步撤销。",
"inputSchema": {
"type": "object",
"properties": {
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
},
"size": {
"type": "object",
"properties": {
"width": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
},
"height": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
}
},
"required": ["width", "height"],
"additionalProperties": false
},
"widget": {
"type": "object",
"properties": {
"top": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"bottom": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"left": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"right": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"horizontalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"verticalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": [],
"additionalProperties": false
},
"save": {
"type": "boolean"
},
"label": {
"type": "string",
"maxLength": 512
},
"color": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
},
"fontSize": {
"type": "number",
"minimum": 1,
"maximum": 1024
},
"interactable": {
"type": "boolean"
}
},
"required": ["parentNid", "label"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_apply_ui_spec",
"description": "事务创建最多 64 个节点、12 层 UI,支持 Layout/Widget/九宫格;运行态回读,失败回滚,整步撤销。",
"inputSchema": {
"type": "object",
"properties": {
"parentNid": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "integer",
"minimum": 1,
"maximum": 2147483647
}
],
"description": "使用查询返回的 NID 或 UUID;场景切换后重新查询。"
},
"nodes": {
"type": "array",
"items": {
"$ref": "#/$defs/uiNode"
},
"minItems": 1,
"maxItems": 64
},
"save": {
"type": "boolean"
}
},
"required": ["parentNid", "nodes"],
"additionalProperties": false,
"$defs": {
"uiNode": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"kind": {
"type": "string",
"enum": ["container", "shape", "label", "sprite", "button"]
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"active": {
"type": "boolean"
},
"position": {
"type": "object",
"properties": {
"x": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"y": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"z": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": ["x", "y", "z"],
"additionalProperties": false
},
"size": {
"type": "object",
"properties": {
"width": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
},
"height": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
}
},
"required": ["width", "height"],
"additionalProperties": false
},
"color": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$"
},
"shape": {
"type": "string",
"enum": ["circle", "rectangle", "rounded-rectangle"]
},
"text": {
"type": "string",
"maxLength": 8192
},
"fontSize": {
"type": "number",
"minimum": 1,
"maximum": 1024
},
"lineHeight": {
"type": "number",
"minimum": 1,
"maximum": 2048
},
"horizontalAlign": {
"type": "string",
"enum": ["left", "center", "right"]
},
"verticalAlign": {
"type": "string",
"enum": ["top", "center", "bottom"]
},
"assetPath": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"nineSlice": {
"type": "boolean"
},
"interactable": {
"type": "boolean"
},
"buttonLabel": {
"type": "string",
"maxLength": 512
},
"layout": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["horizontal", "vertical", "grid"]
},
"resizeMode": {
"type": "string",
"enum": ["none", "container", "children"]
},
"spacingX": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"spacingY": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"paddingLeft": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"paddingRight": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"paddingTop": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"paddingBottom": {
"type": "number",
"minimum": 0,
"maximum": 1000000000
},
"cellSize": {
"type": "object",
"properties": {
"width": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
},
"height": {
"type": "number",
"minimum": 0.01,
"maximum": 16384
}
},
"required": ["width", "height"],
"additionalProperties": false
},
"constraint": {
"type": "string",
"enum": ["none", "fixed-row", "fixed-column"]
},
"constraintNum": {
"type": "integer",
"minimum": 1,
"maximum": 64
}
},
"required": ["type"],
"additionalProperties": false
},
"widget": {
"type": "object",
"properties": {
"top": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"bottom": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"left": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"right": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"horizontalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
},
"verticalCenter": {
"type": "number",
"minimum": -1000000000,
"maximum": 1000000000
}
},
"required": [],
"additionalProperties": false
},
"children": {
"type": "array",
"items": {
"$ref": "#/$defs/uiNode"
},
"maxItems": 64
}
},
"required": ["kind"],
"additionalProperties": false
}
}
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_preview_debug_start",
"description": "在插件自有 Chromium 窗口打开当前项目的 loopback 网页预览,采集 console、JS 异常和失败网络请求。",
"inputSchema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"minLength": 1,
"maxLength": 2048
},
"timeoutMs": {
"type": "integer",
"minimum": 3000,
"maximum": 30000
}
},
"required": ["url"],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_preview_debug_read",
"description": "读取插件托管预览事件;缺省只读最近事件,不清除缓存。",
"inputSchema": {
"type": "object",
"properties": {
"maxEvents": {
"type": "integer",
"minimum": 1,
"maximum": 1000
},
"errorsOnly": {
"type": "boolean"
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_preview_debug_capture",
"description": "截图当前插件托管的预览窗口,返回 PNG。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"destructiveHint": false,
"idempotentHint": true,
"openWorldHint": false
}
},
{
"name": "cocos_preview_debug_stop",
"description": "关闭本插件创建的预览窗口,保留用户的其它编辑器和浏览器。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_save_scene",
"description": "保存当前场景;首次保存可传 assets 下的新 .scene 路径,缺省 assets/Main.scene;拒绝覆盖其它场景。",
"inputSchema": {
"type": "object",
"properties": {
"path": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_editor_undo",
"description": "执行一次 Cocos 官方编辑器撤销并报告实际变化。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
},
{
"name": "cocos_mcp_undo_last",
"description": "撤销最近一次内置 Cocos 编辑事务;用户已做后续编辑时拒绝覆盖。",
"inputSchema": {
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": false
}
}
]