diff --git a/CHANGELOG.md b/CHANGELOG.md index ab2e0ec..f1600b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ This project follows a simple changelog format inspired by [Keep a Changelog](ht - `resources/templates/list` - `prompts/list` - `prompts/get` -- `core` tool profile with 50 high-signal tools. +- `core` tool profile with 19 high-signal tools. - `full` tool profile with 67 tools. - Scene and hierarchy inspection 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. - Simplified the Cocos panel to focus on service management and MCP client configuration. - 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 diff --git a/README.md b/README.md index ca2f670..282b786 100644 --- a/README.md +++ b/README.md @@ -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. - 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. - 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. @@ -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 | | Primary execution tool | `execute_javascript` | `execute_code` | | 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 | | 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: -- **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 - **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 +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 | Resource | Description | diff --git a/README_CN.md b/README_CN.md index 7793ffd..2ea681a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -194,7 +194,7 @@ url = "http://127.0.0.1:8765/" - 这是一个 **仅限 Editor** 的扩展,用于自动化 Cocos Creator,不会给最终游戏包添加运行时依赖。 - MCP Server 默认监听 `http://127.0.0.1:8765/`。 -- 默认 `core` profile 暴露 50 个高频工具;如果需要完整工具集,可在面板切到 `full`,暴露全部 67 个工具。 +- 默认 `core` profile 暴露 19 个高频工具;如果需要完整工具集,可在面板切到 `full`,暴露全部 67 个工具。 - 所有已暴露的 MCP 工具都会直接执行,Cocos 扩展里没有额外 approval 开关。 - 推荐工作流是优先使用 `execute_javascript`,再配合截图、诊断、资产、检查类工具。 - 如果在面板里修改端口或工具暴露模式,扩展会自动保存配置,并在需要时重启服务。 @@ -227,7 +227,7 @@ Funplay MCP for Cocos 延续 Funplay MCP for Unity 的设计原则,并针对 C | 内置服务 | 内嵌 HTTP MCP Server | 内嵌 HTTP MCP Server | | 主执行工具 | `execute_javascript` | `execute_code` | | 主语言 | 场景/编辑器上下文中的 JavaScript | Unity 编辑器/运行态中的 C# | -| 默认工具集 | `core`,50 个工具 | 聚焦版 `core` 工具集 | +| 默认工具集 | `core`,19 个工具 | 聚焦版 `core` 工具集 | | 完整工具集 | 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 自动化 - **Prompts** — `fix_script_errors`、`create_playable_prototype`、`scene_validation`、`auto_wire_scene` - **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 | Resource | 说明 | diff --git a/lib/tool-registry.js b/lib/tool-registry.js index f3132e1..a68cd4a 100644 --- a/lib/tool-registry.js +++ b/lib/tool-registry.js @@ -213,7 +213,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'find_nodes', - profile: 'core', + profile: 'full', description: '[core] Find scene nodes by exact name, partial path, or component type.', inputSchema: createSchema( { @@ -228,7 +228,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'inspect_node', - profile: 'core', + profile: 'full', description: '[core] Inspect a specific node by path, uuid, or name.', inputSchema: createSchema( { @@ -325,7 +325,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'list_prefabs', - profile: 'core', + profile: 'full', description: '[core] List prefab assets in the project.', inputSchema: createSchema( { @@ -443,14 +443,14 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'get_editor_selection', - profile: 'core', + profile: 'full', description: '[core] Return the current node and asset selection in the Cocos editor.', inputSchema: createSchema({}, []), handler: async () => getCurrentSelection(), }, { name: 'list_components', - profile: 'core', + profile: 'full', description: '[core] List components attached to a scene node.', inputSchema: createSchema( { @@ -464,7 +464,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'inspect_component', - profile: 'core', + profile: 'full', description: '[core] Inspect a component attached to a node.', inputSchema: createSchema( { @@ -627,7 +627,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'list_cameras', - profile: 'core', + profile: 'full', description: '[core] List Camera components in the active scene.', inputSchema: createSchema({}, []), handler: async (args) => sceneBridge.call('listCameras', args), @@ -674,7 +674,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'list_animations', - profile: 'core', + profile: 'full', description: '[core] List Animation components in the active scene or under one node.', inputSchema: createSchema( { @@ -704,7 +704,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'play_animation', - profile: 'core', + profile: 'full', description: '[core] Play an Animation component clip on a node.', inputSchema: createSchema( { @@ -719,7 +719,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'stop_animation', - profile: 'core', + profile: 'full', description: '[core] Stop an Animation component clip on a node.', inputSchema: createSchema( { @@ -734,7 +734,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'read_file', - profile: 'core', + profile: 'full', description: '[core] Read a file from the Cocos project.', inputSchema: createSchema( { @@ -754,7 +754,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'get_file_snippet', - profile: 'core', + profile: 'full', description: '[core] Read a focused snippet around a file line number.', inputSchema: createSchema( { @@ -775,7 +775,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'write_file', - profile: 'core', + profile: 'full', description: '[core] Write or overwrite a file in the Cocos project.', inputSchema: createSchema( { @@ -794,7 +794,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'replace_in_file', - profile: 'core', + profile: 'full', description: '[core] Replace text in a file, useful for script auto-fix loops.', inputSchema: createSchema( { @@ -827,7 +827,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'search_files', - profile: 'core', + profile: 'full', description: '[core] Search project files by simple wildcard pattern.', inputSchema: createSchema( { @@ -856,7 +856,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'list_directory', - profile: 'core', + profile: 'full', description: '[core] List files and directories inside a project directory.', inputSchema: createSchema( { @@ -886,7 +886,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'exists', - profile: 'core', + profile: 'full', description: '[core] Check whether a project file or directory exists.', inputSchema: createSchema( { @@ -907,7 +907,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'refresh_assets', - profile: 'core', + profile: 'full', description: '[core] Best-effort asset database refresh for a file or the assets root.', inputSchema: createSchema( { @@ -945,21 +945,21 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'pause_runtime', - profile: 'core', + profile: 'full', description: '[core] Pause Cocos director game logic execution.', inputSchema: createSchema({}, []), handler: async (args) => sceneBridge.call('pauseRuntime', args), }, { name: 'resume_runtime', - profile: 'core', + profile: 'full', description: '[core] Resume Cocos director game logic execution.', inputSchema: createSchema({}, []), handler: async (args) => sceneBridge.call('resumeRuntime', args), }, { name: 'set_time_scale', - profile: 'core', + profile: 'full', description: '[core] Set Cocos scheduler time scale for runtime validation.', inputSchema: createSchema( { @@ -971,7 +971,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'emit_node_event', - profile: 'core', + profile: 'full', description: '[core] Emit a custom event on a target scene node with an optional JSON payload.', inputSchema: createSchema( { @@ -987,7 +987,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'simulate_button_click', - profile: 'core', + profile: 'full', description: '[core] Simulate a Cocos Button click by emitting click events on the target button node.', inputSchema: createSchema( { @@ -1001,7 +1001,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'invoke_component_method', - profile: 'core', + profile: 'full', description: '[core] Invoke a method on a component for runtime validation and test hooks.', inputSchema: createSchema( { @@ -1049,7 +1049,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { 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.', inputSchema: createSchema( { @@ -1100,7 +1100,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { 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.', inputSchema: createSchema( { @@ -1125,7 +1125,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'simulate_mouse_click', - profile: 'core', + profile: 'full', description: '[core] Send a low-level Electron mouse click to the editor, preview, or simulator window.', inputSchema: createSchema( { @@ -1144,7 +1144,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'simulate_mouse_drag', - profile: 'core', + profile: 'full', description: '[core] Send a low-level Electron mouse drag to the editor, preview, or simulator window.', inputSchema: createSchema( { @@ -1166,7 +1166,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { name: 'simulate_key_press', - profile: 'core', + profile: 'full', description: '[core] Send a low-level Electron key press to the editor, preview, or simulator window.', inputSchema: createSchema( { @@ -1183,7 +1183,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { 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.', inputSchema: createSchema( { @@ -1199,7 +1199,7 @@ function createToolRegistry({ getRuntimeContext, interactionLog, sceneBridge, ed }, { 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.', inputSchema: createSchema( {