Refine core tool profile

This commit is contained in:
winlifes
2026-04-15 18:03:27 +08:00
parent 05446c973d
commit bedb721e5a
4 changed files with 43 additions and 38 deletions
+2 -1
View File
@@ -26,7 +26,7 @@ This project follows a simple changelog format inspired by [Keep a Changelog](ht
- `resources/templates/list` - `resources/templates/list`
- `prompts/list` - `prompts/list`
- `prompts/get` - `prompts/get`
- `core` tool profile with 50 high-signal tools. - `core` tool profile with 19 high-signal tools.
- `full` tool profile with 67 tools. - `full` tool profile with 67 tools.
- Scene and hierarchy inspection tools. - Scene and hierarchy inspection tools.
- Node, component, UI, camera, animation, prefab, and asset tools. - Node, component, UI, camera, animation, prefab, and asset tools.
@@ -46,6 +46,7 @@ This project follows a simple changelog format inspired by [Keep a Changelog](ht
- Promoted `execute_javascript` as the recommended primary tool across tool descriptions, prompts, and documentation. - Promoted `execute_javascript` as the recommended primary tool across tool descriptions, prompts, and documentation.
- Simplified the Cocos panel to focus on service management and MCP client configuration. - Simplified the Cocos panel to focus on service management and MCP client configuration.
- Changed the menu entry to `Funplay > MCP Server`. - Changed the menu entry to `Funplay > MCP Server`.
- Slimmed the default `core` profile from 50 tools to 19 high-signal tools centered on project understanding, diagnostics, and visual validation.
### Fixed ### Fixed
+5 -3
View File
@@ -194,7 +194,7 @@ Try a higher-level prompt in your AI client:
- This extension is **Editor-only**. It is meant to automate Cocos Creator, not to add runtime dependencies to your final game build. - This extension is **Editor-only**. It is meant to automate Cocos Creator, not to add runtime dependencies to your final game build.
- The MCP server listens on `http://127.0.0.1:8765/` by default. - The MCP server listens on `http://127.0.0.1:8765/` by default.
- The default `core` profile exposes 50 high-signal tools. Switch to `full` in the panel if you want all 67 tools exposed. - The default `core` profile exposes 19 high-signal tools. Switch to `full` in the panel if you want all 67 tools exposed.
- All exposed MCP tools execute directly. There is no extra approval toggle inside the Cocos extension. - All exposed MCP tools execute directly. There is no extra approval toggle inside the Cocos extension.
- The recommended workflow is `execute_javascript` first, then focused helper tools for screenshots, diagnostics, assets, and inspection. - The recommended workflow is `execute_javascript` first, then focused helper tools for screenshots, diagnostics, assets, and inspection.
- If you change the server port or tool exposure in the panel, the extension saves the config and restarts the server when needed. - If you change the server port or tool exposure in the panel, the extension saves the config and restarts the server when needed.
@@ -227,7 +227,7 @@ Funplay MCP for Cocos follows the same design principles as Funplay MCP for Unit
| Embedded server | Built-in HTTP MCP server | Built-in HTTP MCP server | | Embedded server | Built-in HTTP MCP server | Built-in HTTP MCP server |
| Primary execution tool | `execute_javascript` | `execute_code` | | Primary execution tool | `execute_javascript` | `execute_code` |
| Primary language | JavaScript in scene/editor contexts | C# in Unity editor/runtime contexts | | Primary language | JavaScript in scene/editor contexts | C# in Unity editor/runtime contexts |
| Default profile | `core` with 50 tools | `core` focused tool profile | | Default profile | `core` with 19 tools | `core` focused tool profile |
| Full profile | 67 tools | 79 tools | | Full profile | 67 tools | 79 tools |
| Client setup | One-click config panel | One-click config window | | Client setup | One-click config panel | One-click config window |
@@ -235,11 +235,13 @@ Funplay MCP for Cocos follows the same design principles as Funplay MCP for Unit
The current package exposes four capability layers: The current package exposes four capability layers:
- **Tools** — 50 tools in `core`, 67 tools in `full` - **Tools** — 19 tools in `core`, 67 tools in `full`
- **Primary execution** — `execute_javascript` for scene/runtime and editor/browser automation - **Primary execution** — `execute_javascript` for scene/runtime and editor/browser automation
- **Prompts** — `fix_script_errors`, `create_playable_prototype`, `scene_validation`, and `auto_wire_scene` - **Prompts** — `fix_script_errors`, `create_playable_prototype`, `scene_validation`, and `auto_wire_scene`
- **Resources** — project context, scene summaries, current selection, script diagnostics, asset selection, and MCP interaction history - **Resources** — project context, scene summaries, current selection, script diagnostics, asset selection, and MCP interaction history
The default `core` set is intentionally small: `execute_javascript`, `execute_scene_script`, `execute_editor_script`, `get_project_info`, `get_scene_info`, `get_hierarchy`, `list_scenes`, `open_scene`, `list_assets`, `inspect_asset`, `open_asset`, `select_asset`, `run_script_diagnostics`, `get_script_diagnostic_context`, `get_runtime_state`, `capture_editor_screenshot`, `capture_scene_screenshot`, `capture_preview_screenshot`, and `list_editor_windows`.
## Built-in Resources ## Built-in Resources
| Resource | Description | | Resource | Description |
+5 -3
View File
@@ -194,7 +194,7 @@ url = "http://127.0.0.1:8765/"
- 这是一个 **仅限 Editor** 的扩展,用于自动化 Cocos Creator,不会给最终游戏包添加运行时依赖。 - 这是一个 **仅限 Editor** 的扩展,用于自动化 Cocos Creator,不会给最终游戏包添加运行时依赖。
- MCP Server 默认监听 `http://127.0.0.1:8765/` - MCP Server 默认监听 `http://127.0.0.1:8765/`
- 默认 `core` profile 暴露 50 个高频工具;如果需要完整工具集,可在面板切到 `full`,暴露全部 67 个工具。 - 默认 `core` profile 暴露 19 个高频工具;如果需要完整工具集,可在面板切到 `full`,暴露全部 67 个工具。
- 所有已暴露的 MCP 工具都会直接执行,Cocos 扩展里没有额外 approval 开关。 - 所有已暴露的 MCP 工具都会直接执行,Cocos 扩展里没有额外 approval 开关。
- 推荐工作流是优先使用 `execute_javascript`,再配合截图、诊断、资产、检查类工具。 - 推荐工作流是优先使用 `execute_javascript`,再配合截图、诊断、资产、检查类工具。
- 如果在面板里修改端口或工具暴露模式,扩展会自动保存配置,并在需要时重启服务。 - 如果在面板里修改端口或工具暴露模式,扩展会自动保存配置,并在需要时重启服务。
@@ -227,7 +227,7 @@ Funplay MCP for Cocos 延续 Funplay MCP for Unity 的设计原则,并针对 C
| 内置服务 | 内嵌 HTTP MCP Server | 内嵌 HTTP MCP Server | | 内置服务 | 内嵌 HTTP MCP Server | 内嵌 HTTP MCP Server |
| 主执行工具 | `execute_javascript` | `execute_code` | | 主执行工具 | `execute_javascript` | `execute_code` |
| 主语言 | 场景/编辑器上下文中的 JavaScript | Unity 编辑器/运行态中的 C# | | 主语言 | 场景/编辑器上下文中的 JavaScript | Unity 编辑器/运行态中的 C# |
| 默认工具集 | `core`50 个工具 | 聚焦版 `core` 工具集 | | 默认工具集 | `core`19 个工具 | 聚焦版 `core` 工具集 |
| 完整工具集 | 67 个工具 | 79 个工具 | | 完整工具集 | 67 个工具 | 79 个工具 |
| 客户端配置 | 一键配置面板 | 一键配置窗口 | | 客户端配置 | 一键配置面板 | 一键配置窗口 |
@@ -235,11 +235,13 @@ Funplay MCP for Cocos 延续 Funplay MCP for Unity 的设计原则,并针对 C
当前包提供四层能力: 当前包提供四层能力:
- **Tools** — `core`50 个工具,`full` 下 67 个工具 - **Tools** — `core`19 个工具,`full` 下 67 个工具
- **Primary execution** — `execute_javascript` 用于场景/运行态和编辑器/browser 自动化 - **Primary execution** — `execute_javascript` 用于场景/运行态和编辑器/browser 自动化
- **Prompts** — `fix_script_errors``create_playable_prototype``scene_validation``auto_wire_scene` - **Prompts** — `fix_script_errors``create_playable_prototype``scene_validation``auto_wire_scene`
- **Resources** — 项目上下文、场景摘要、当前选择、脚本诊断、资产选择和 MCP 交互历史 - **Resources** — 项目上下文、场景摘要、当前选择、脚本诊断、资产选择和 MCP 交互历史
当前默认 `core` 工具集刻意保持精简,只包含:`execute_javascript``execute_scene_script``execute_editor_script``get_project_info``get_scene_info``get_hierarchy``list_scenes``open_scene``list_assets``inspect_asset``open_asset``select_asset``run_script_diagnostics``get_script_diagnostic_context``get_runtime_state``capture_editor_screenshot``capture_scene_screenshot``capture_preview_screenshot``list_editor_windows`
## 内置 Resources ## 内置 Resources
| Resource | 说明 | | Resource | 说明 |
+31 -31
View File
@@ -213,7 +213,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'find_nodes', name: 'find_nodes',
profile: 'core', profile: 'full',
description: '[core] Find scene nodes by exact name, partial path, or component type.', description: '[core] Find scene nodes by exact name, partial path, or component type.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -228,7 +228,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'inspect_node', name: 'inspect_node',
profile: 'core', profile: 'full',
description: '[core] Inspect a specific node by path, uuid, or name.', description: '[core] Inspect a specific node by path, uuid, or name.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -325,7 +325,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'list_prefabs', name: 'list_prefabs',
profile: 'core', profile: 'full',
description: '[core] List prefab assets in the project.', description: '[core] List prefab assets in the project.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -443,14 +443,14 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'get_editor_selection', name: 'get_editor_selection',
profile: 'core', profile: 'full',
description: '[core] Return the current node and asset selection in the Cocos editor.', description: '[core] Return the current node and asset selection in the Cocos editor.',
inputSchema: createSchema({}, []), inputSchema: createSchema({}, []),
handler: async () => getCurrentSelection(), handler: async () => getCurrentSelection(),
}, },
{ {
name: 'list_components', name: 'list_components',
profile: 'core', profile: 'full',
description: '[core] List components attached to a scene node.', description: '[core] List components attached to a scene node.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -464,7 +464,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'inspect_component', name: 'inspect_component',
profile: 'core', profile: 'full',
description: '[core] Inspect a component attached to a node.', description: '[core] Inspect a component attached to a node.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -627,7 +627,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'list_cameras', name: 'list_cameras',
profile: 'core', profile: 'full',
description: '[core] List Camera components in the active scene.', description: '[core] List Camera components in the active scene.',
inputSchema: createSchema({}, []), inputSchema: createSchema({}, []),
handler: async (args) => sceneBridge.call('listCameras', args), handler: async (args) => sceneBridge.call('listCameras', args),
@@ -674,7 +674,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'list_animations', name: 'list_animations',
profile: 'core', profile: 'full',
description: '[core] List Animation components in the active scene or under one node.', description: '[core] List Animation components in the active scene or under one node.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -704,7 +704,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'play_animation', name: 'play_animation',
profile: 'core', profile: 'full',
description: '[core] Play an Animation component clip on a node.', description: '[core] Play an Animation component clip on a node.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -719,7 +719,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'stop_animation', name: 'stop_animation',
profile: 'core', profile: 'full',
description: '[core] Stop an Animation component clip on a node.', description: '[core] Stop an Animation component clip on a node.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -734,7 +734,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'read_file', name: 'read_file',
profile: 'core', profile: 'full',
description: '[core] Read a file from the Cocos project.', description: '[core] Read a file from the Cocos project.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -754,7 +754,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'get_file_snippet', name: 'get_file_snippet',
profile: 'core', profile: 'full',
description: '[core] Read a focused snippet around a file line number.', description: '[core] Read a focused snippet around a file line number.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -775,7 +775,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'write_file', name: 'write_file',
profile: 'core', profile: 'full',
description: '[core] Write or overwrite a file in the Cocos project.', description: '[core] Write or overwrite a file in the Cocos project.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -794,7 +794,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'replace_in_file', name: 'replace_in_file',
profile: 'core', profile: 'full',
description: '[core] Replace text in a file, useful for script auto-fix loops.', description: '[core] Replace text in a file, useful for script auto-fix loops.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -827,7 +827,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'search_files', name: 'search_files',
profile: 'core', profile: 'full',
description: '[core] Search project files by simple wildcard pattern.', description: '[core] Search project files by simple wildcard pattern.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -856,7 +856,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'list_directory', name: 'list_directory',
profile: 'core', profile: 'full',
description: '[core] List files and directories inside a project directory.', description: '[core] List files and directories inside a project directory.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -886,7 +886,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'exists', name: 'exists',
profile: 'core', profile: 'full',
description: '[core] Check whether a project file or directory exists.', description: '[core] Check whether a project file or directory exists.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -907,7 +907,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'refresh_assets', name: 'refresh_assets',
profile: 'core', profile: 'full',
description: '[core] Best-effort asset database refresh for a file or the assets root.', description: '[core] Best-effort asset database refresh for a file or the assets root.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -945,21 +945,21 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'pause_runtime', name: 'pause_runtime',
profile: 'core', profile: 'full',
description: '[core] Pause Cocos director game logic execution.', description: '[core] Pause Cocos director game logic execution.',
inputSchema: createSchema({}, []), inputSchema: createSchema({}, []),
handler: async (args) => sceneBridge.call('pauseRuntime', args), handler: async (args) => sceneBridge.call('pauseRuntime', args),
}, },
{ {
name: 'resume_runtime', name: 'resume_runtime',
profile: 'core', profile: 'full',
description: '[core] Resume Cocos director game logic execution.', description: '[core] Resume Cocos director game logic execution.',
inputSchema: createSchema({}, []), inputSchema: createSchema({}, []),
handler: async (args) => sceneBridge.call('resumeRuntime', args), handler: async (args) => sceneBridge.call('resumeRuntime', args),
}, },
{ {
name: 'set_time_scale', name: 'set_time_scale',
profile: 'core', profile: 'full',
description: '[core] Set Cocos scheduler time scale for runtime validation.', description: '[core] Set Cocos scheduler time scale for runtime validation.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -971,7 +971,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'emit_node_event', name: 'emit_node_event',
profile: 'core', profile: 'full',
description: '[core] Emit a custom event on a target scene node with an optional JSON payload.', description: '[core] Emit a custom event on a target scene node with an optional JSON payload.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -987,7 +987,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'simulate_button_click', name: 'simulate_button_click',
profile: 'core', profile: 'full',
description: '[core] Simulate a Cocos Button click by emitting click events on the target button node.', description: '[core] Simulate a Cocos Button click by emitting click events on the target button node.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1001,7 +1001,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'invoke_component_method', name: 'invoke_component_method',
profile: 'core', profile: 'full',
description: '[core] Invoke a method on a component for runtime validation and test hooks.', description: '[core] Invoke a method on a component for runtime validation and test hooks.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1049,7 +1049,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'capture_desktop_screenshot', name: 'capture_desktop_screenshot',
profile: 'core', profile: 'full',
description: '[core] Capture a screenshot from the local desktop and return it as an MCP image payload.', description: '[core] Capture a screenshot from the local desktop and return it as an MCP image payload.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1100,7 +1100,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'capture_game_screenshot', name: 'capture_game_screenshot',
profile: 'core', profile: 'full',
description: '[core] Capture the Game/Preview panel region from the editor window with panel-level cropping when available.', description: '[core] Capture the Game/Preview panel region from the editor window with panel-level cropping when available.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1125,7 +1125,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'simulate_mouse_click', name: 'simulate_mouse_click',
profile: 'core', profile: 'full',
description: '[core] Send a low-level Electron mouse click to the editor, preview, or simulator window.', description: '[core] Send a low-level Electron mouse click to the editor, preview, or simulator window.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1144,7 +1144,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'simulate_mouse_drag', name: 'simulate_mouse_drag',
profile: 'core', profile: 'full',
description: '[core] Send a low-level Electron mouse drag to the editor, preview, or simulator window.', description: '[core] Send a low-level Electron mouse drag to the editor, preview, or simulator window.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1166,7 +1166,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'simulate_key_press', name: 'simulate_key_press',
profile: 'core', profile: 'full',
description: '[core] Send a low-level Electron key press to the editor, preview, or simulator window.', description: '[core] Send a low-level Electron key press to the editor, preview, or simulator window.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1183,7 +1183,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'simulate_key_combo', name: 'simulate_key_combo',
profile: 'core', profile: 'full',
description: '[core] Send a low-level Electron modified key press such as Ctrl+S or Cmd+P.', description: '[core] Send a low-level Electron modified key press such as Ctrl+S or Cmd+P.',
inputSchema: createSchema( inputSchema: createSchema(
{ {
@@ -1199,7 +1199,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed
}, },
{ {
name: 'simulate_preview_input', name: 'simulate_preview_input',
profile: 'core', profile: 'full',
description: '[core] Convenience wrapper for low-level preview/simulator input. Uses mouse click by default or key press when keyCode is provided.', description: '[core] Convenience wrapper for low-level preview/simulator input. Uses mouse click by default or key press when keyCode is provided.',
inputSchema: createSchema( inputSchema: createSchema(
{ {