Skip to content

Commit 79153f4

Browse files
committed
docs(readme): synchronize troubleshooting and support sections across all languages EN, CN & JA
change: renamed notify_message tool to send_console_log
1 parent 7ae0246 commit 79153f4

14 files changed

+198
-58
lines changed

Editor/Tools/NotifyMessageTool.cs renamed to Editor/Tools/SendConsoleLogTool.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace McpUnity.Tools
88
/// <summary>
99
/// Tool for sending notification messages to the Unity console
1010
/// </summary>
11-
public class NotifyMessageTool : McpToolBase
11+
public class SendConsoleLogTool : McpToolBase
1212
{
13-
public NotifyMessageTool()
13+
public SendConsoleLogTool()
1414
{
15-
Name = "notify_message";
15+
Name = "send_console_log";
1616
Description = "Sends a message to the Unity console";
1717
}
1818

Editor/Tools/NotifyMessageTool.cs.meta renamed to Editor/Tools/SendConsoleLogTool.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/UnityBridge/McpUnityServer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ private void RegisterTools()
163163
RunTestsTool runTestsTool = new RunTestsTool(_testRunnerService);
164164
_tools.Add(runTestsTool.Name, runTestsTool);
165165

166-
// Register NotifyMessageTool
167-
NotifyMessageTool notifyMessageTool = new NotifyMessageTool();
168-
_tools.Add(notifyMessageTool.Name, notifyMessageTool);
166+
// Register SendConsoleLogTool
167+
SendConsoleLogTool sendConsoleLogTool = new SendConsoleLogTool();
168+
_tools.Add(sendConsoleLogTool.Name, sendConsoleLogTool);
169169

170170
// Register UpdateComponentTool
171171
UpdateComponentTool updateComponentTool = new UpdateComponentTool();

README-ja.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ MCP Unityは、Unityの`Library/PackedCache`フォルダーをワークスペー
7676
- `run_tests`: Unityテストランナーを使用してテストを実行
7777
> **例:** "プロジェクト内のすべてのEditModeテストを実行"
7878
79-
- `notify_message`: Unityエディターにメッセージを表示
80-
> **例:** "タスクが完了したことをUnityに通知"
79+
- `send_console_log`: Unityにコンソールログを送信
80+
> **例:** "Unity Editorにコンソールログを送信"
8181
8282
- `add_asset_to_scene`: AssetDatabaseからアセットをUnityシーンに追加
8383
> **例:** "プロジェクトからPlayerプレハブを現在のシーンに追加"
@@ -230,30 +230,61 @@ MCP Unityサーバーをデバッグするには、以下の方法を使用で
230230

231231
## トラブルシューティング
232232

233-
### <a name="common-issues"></a>よくある問題
234-
235-
#### サーバーが起動しない
233+
<details>
234+
<summary><span style="font-size: 1.1em; font-weight: bold;">接続の問題</span></summary>
236235

237-
- Node.js 18以降がインストールされていることを確認
238-
- npm 9以降がインストールされていることを確認
239-
- MCP Unityサーバーディレクトリが正しいことを確認
236+
- WebSocketサーバーが実行中であることを確認してください(UnityのServer Windowを確認)
237+
- ファイアウォールの制限が接続を妨げていないか確認してください
238+
- ポート番号が正しいことを確認してください(デフォルトは8080)
239+
- UnityエディターのMCP Serverウィンドウでポート番号を変更できます(ツール > MCP Unity > Server Window)
240+
</details>
240241

241-
#### メニュー項目が実行されない
242+
<details>
243+
<summary><span style="font-size: 1.1em; font-weight: bold;">サーバーが起動しない</span></summary>
242244

243-
- メニュー項目のパスが正しいことを確認(大文字小文字を区別)
244-
- メニュー項目が確認を必要とするかどうかを確認
245-
- メニュー項目が現在のコンテキストで利用可能であることを確認
245+
- Unityコンソールにエラーメッセージがないか確認してください
246+
- Node.jsが正しくインストールされ、PATHで利用可能であることを確認してください
247+
- Serverディレクトリ内の依存関係がすべてインストールされていることを確認してください
248+
</details>
246249

247-
#### Play Modeテスト実行時に `Connection failed` エラー
250+
<details>
251+
<summary><span style="font-size: 1.1em; font-weight: bold;">Play Modeテスト実行時の接続失敗</span></summary>
248252

249-
`run_tests` ツールの実行が次のエラーを返します
253+
`run_tests` ツールは以下の応答を返します
250254
```
251255
Error:
252256
Connection failed: Unknown error
253257
```
254258

255-
このエラーは、Play Modeに切り替わる際にドメインがリロードされるため、ブリッジ接続が失われることで発生します。
256-
回避方法は、**Edit > Project Settings > Editor > "Enter Play Mode Settings"****Reload Domain** をオフにすることです。
259+
このエラーは、Play Modeへ切り替える際にドメインリロードが発生し、ブリッジ接続が失われるために発生します。
260+
回避策は、**Edit > Project Settings > Editor > "Enter Play Mode Settings"****Reload Domain** をオフにすることです。
261+
</details>
262+
263+
## サポート・フィードバック
264+
265+
ご質問やサポートが必要な場合は、このリポジトリの[issue](https://github.com/CoderGamester/mcp-unity/issues)をご利用ください。
266+
267+
また、以下でも連絡可能です:
268+
- Linkedin: [![](https://img.shields.io/badge/LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white 'LinkedIn')](https://www.linkedin.com/in/miguel-tomas/)
269+
- Discord: gamester7178
270+
- メール: game.gamester@gmail.com
271+
272+
## コントリビューション
273+
274+
コントリビューションは大歓迎です!Pull Requestの送信やIssueの提出をお待ちしています。
275+
276+
**変更は [Conventional Commits](https://www.conventionalcommits.org/ja/v1.0.0/) フォーマットに従ってください。**
277+
278+
## ライセンス
279+
280+
本プロジェクトは [MIT License](License.md) の下で提供されています。
281+
282+
## 謝辞
283+
284+
- [Model Context Protocol](https://modelcontextprotocol.io)
285+
- [Unity Technologies](https://unity.com)
286+
- [Node.js](https://nodejs.org)
287+
- [WebSocket-Sharp](https://github.com/sta/websocket-sharp)
257288

258289
## 貢献
259290

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ MCP Unity provides automatic integration with VSCode-like IDEs (Visual Studio Co
7676
- `run_tests`: Runs tests using the Unity Test Runner
7777
> **Example prompt:** "Run all the EditMode tests in my project"
7878
79-
- `notify_message`: Displays messages in the Unity Editor
80-
> **Example prompt:** "Send a notification to Unity that the task has been completed"
79+
- `send_console_log`: Send a console log to Unity
80+
> **Example prompt:** "Send a console log to Unity Editor"
8181
8282
- `add_asset_to_scene`: Adds an asset from the AssetDatabase to the Unity scene
8383
> **Example prompt:** "Add the Player prefab from my project to the current scene"
@@ -306,8 +306,7 @@ Don't forget to shutdown the server with `Ctrl + C` before closing the terminal
306306
<summary><span style="font-size: 1.1em; font-weight: bold;">Connection Issues</span></summary>
307307

308308
- Ensure the WebSocket server is running (check the Server Window in Unity)
309-
- Check if there are any firewall restrictions blocking the connection
310-
- Make sure the port number is correct (default is 8080)
309+
- Send a console log message from MCP client to force a reconnection between MCP client and Unity server
311310
- Change the port number in the Unity Editor MCP Server window. (Tools > MCP Unity > Server Window)
312311
</details>
313312

@@ -319,14 +318,6 @@ Don't forget to shutdown the server with `Ctrl + C` before closing the terminal
319318
- Verify that all dependencies are installed in the Server directory
320319
</details>
321320

322-
<details>
323-
<summary><span style="font-size: 1.1em; font-weight: bold;">Menu Items Not Executing</span></summary>
324-
325-
- Ensure the menu item path is correct (case-sensitive)
326-
- Check if the menu item requires confirmation
327-
- Verify that the menu item is available in the current context
328-
</details>
329-
330321
<details>
331322
<summary><span style="font-size: 1.1em; font-weight: bold;">Connection failed when running Play Mode tests</span></summary>
332323

README_zh-CN.md

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ MCP Unity 通过将 Unity `Library/PackedCache` 文件夹添加到您的工作
7878
- `run_tests`: 使用 Unity 测试运行器运行测试
7979
> **示例提示:** "运行我项目中所有的 EditMode 测试"
8080
81-
- `notify_message`: Unity 编辑器中显示消息
82-
> **示例提示:** "发送通知到 Unity 告知任务已完成"
81+
- `send_console_log`: 发送控制台日志到 Unity
82+
> **示例提示:** "发送控制台日志到 Unity 编辑器"
8383
8484
- `add_asset_to_scene`: 将 AssetDatabase 中的资源添加到 Unity 场景中
8585
> **示例提示:** "将我的项目中的 Player 预制体添加到当前场景"
@@ -232,30 +232,61 @@ MCP Unity 通过将 Unity `Library/PackedCache` 文件夹添加到您的工作
232232

233233
## 故障排除
234234

235-
### <a name="common-issues"></a>常见问题
236-
237-
#### 服务器无法启动
235+
<details>
236+
<summary><span style="font-size: 1.1em; font-weight: bold;">连接问题</span></summary>
238237

239-
- 确保 Node.js 18 或更高版本已安装
240-
- 验证 npm 9 或更高版本已安装
241-
- 检查 MCP Unity 服务器目录是否正确
238+
- 确保 WebSocket 服务器正在运行(检查 Unity 的 Server Window)
239+
- 检查是否有防火墙限制阻止连接
240+
- 确认端口号正确(默认是 8080)
241+
- 可在 Unity 编辑器 MCP Server 窗口更改端口号。(工具 > MCP Unity > Server Window)
242+
</details>
242243

243-
#### 菜单项无法执行
244+
<details>
245+
<summary><span style="font-size: 1.1em; font-weight: bold;">服务器无法启动</span></summary>
244246

245-
- 确保菜单项路径正确(区分大小写)
246-
- 检查菜单项是否需要确认
247-
- 验证菜单项在当前上下文中是否可用
247+
- 检查 Unity 控制台是否有错误消息
248+
- 确保 Node.js 已正确安装并可在 PATH 中访问
249+
- 验证 Server 目录下所有依赖均已安装
250+
</details>
248251

249-
#### 运行播放模式测试时连接失败
252+
<details>
253+
<summary><span style="font-size: 1.1em; font-weight: bold;">运行播放模式测试时连接失败</span></summary>
250254

251255
`run_tests` 工具返回以下响应:
252256
```
253257
Error:
254258
Connection failed: Unknown error
255259
```
256260

257-
发生此错误的原因是在切换到播放模式触发域重新加载时,桥接连接会丢失
261+
发生此错误的原因是在切换到播放模式时域重新加载,导致桥接连接丢失
258262
解决方法是在 **Edit > Project Settings > Editor > "Enter Play Mode Settings"** 中关闭 **Reload Domain**
263+
</details>
264+
265+
## 支持与反馈
266+
267+
如有任何问题或需要支持,请在本仓库[提交 issue](https://github.com/CoderGamester/mcp-unity/issues)
268+
269+
你也可以通过以下方式联系:
270+
- Linkedin: [![](https://img.shields.io/badge/LinkedIn-0077B5?style=flat&logo=linkedin&logoColor=white 'LinkedIn')](https://www.linkedin.com/in/miguel-tomas/)
271+
- Discord: gamester7178
272+
- 邮箱: game.gamester@gmail.com
273+
274+
## 贡献
275+
276+
欢迎贡献!请随时提交 Pull Request 或提出 Issue。
277+
278+
**请遵循 [Conventional Commits](https://www.conventionalcommits.org/zh-hans/v1.0.0/) 格式提交更改。**
279+
280+
## 许可证
281+
282+
本项目采用 [MIT License](License.md) 授权。
283+
284+
## 鸣谢
285+
286+
- [Model Context Protocol](https://modelcontextprotocol.io)
287+
- [Unity Technologies](https://unity.com)
288+
- [Node.js](https://nodejs.org)
289+
- [WebSocket-Sharp](https://github.com/sta/websocket-sharp)
259290

260291
## 贡献
261292

Server/build/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createMenuItemTool } from './tools/menuItemTool.js';
77
import { createSelectGameObjectTool } from './tools/selectGameObjectTool.js';
88
import { createAddPackageTool } from './tools/addPackageTool.js';
99
import { createRunTestsTool } from './tools/runTestsTool.js';
10-
import { createNotifyMessageTool } from './tools/notifyMessageTool.js';
10+
import { createSendConsoleLogTool } from './tools/sendConsoleLogTool.js';
1111
import { createUpdateComponentTool } from './tools/updateComponentTool.js';
1212
import { createAddAssetToSceneTool } from './tools/addAssetToSceneTool.js';
1313
import { createGetMenuItemsResource } from './resources/getMenuItemResource.js';
@@ -39,7 +39,7 @@ createMenuItemTool(server, mcpUnity, toolLogger);
3939
createSelectGameObjectTool(server, mcpUnity, toolLogger);
4040
createAddPackageTool(server, mcpUnity, toolLogger);
4141
createRunTestsTool(server, mcpUnity, toolLogger);
42-
createNotifyMessageTool(server, mcpUnity, toolLogger);
42+
createSendConsoleLogTool(server, mcpUnity, toolLogger);
4343
createUpdateComponentTool(server, mcpUnity, toolLogger);
4444
createAddAssetToSceneTool(server, mcpUnity, toolLogger);
4545
// Create and register all resources with the MCP server
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Logger } from '../utils/logger.js';
2+
import { McpUnity } from '../unity/mcpUnity.js';
3+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4+
/**
5+
* Creates and registers the Send Console Log tool with the MCP server
6+
* This tool allows sending messages to the Unity console
7+
*
8+
* @param server The MCP server instance to register with
9+
* @param mcpUnity The McpUnity instance to communicate with Unity
10+
* @param logger The logger instance for diagnostic information
11+
*/
12+
export declare function createSendConsoleLogTool(server: McpServer, mcpUnity: McpUnity, logger: Logger): void;

Server/src/tools/notifyMessageTool.ts.meta renamed to Server/build/tools/sendConsoleLogTool.d.ts.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { z } from 'zod';
2+
import { McpUnityError, ErrorType } from '../utils/errors.js';
3+
// Constants for the tool
4+
const toolName = 'send_console_log';
5+
const toolDescription = 'Sends console log messages to the Unity console';
6+
const paramsSchema = z.object({
7+
message: z.string().describe('The message to display in the Unity console'),
8+
type: z.string().optional().describe('The type of message (info, warning, error) - defaults to info (optional)')
9+
});
10+
/**
11+
* Creates and registers the Send Console Log tool with the MCP server
12+
* This tool allows sending messages to the Unity console
13+
*
14+
* @param server The MCP server instance to register with
15+
* @param mcpUnity The McpUnity instance to communicate with Unity
16+
* @param logger The logger instance for diagnostic information
17+
*/
18+
export function createSendConsoleLogTool(server, mcpUnity, logger) {
19+
logger.info(`Registering tool: ${toolName}`);
20+
// Register this tool with the MCP server
21+
server.tool(toolName, toolDescription, paramsSchema.shape, async (params) => {
22+
try {
23+
logger.info(`Executing tool: ${toolName}`, params);
24+
const result = await toolHandler(mcpUnity, params);
25+
logger.info(`Tool execution successful: ${toolName}`);
26+
return result;
27+
}
28+
catch (error) {
29+
logger.error(`Tool execution failed: ${toolName}`, error);
30+
throw error;
31+
}
32+
});
33+
}
34+
/**
35+
* Handles notification message requests
36+
*
37+
* @param mcpUnity The McpUnity instance to communicate with Unity
38+
* @param params The parameters for the tool
39+
* @returns A promise that resolves to the tool execution result
40+
* @throws McpUnityError if the request to Unity fails
41+
*/
42+
async function toolHandler(mcpUnity, params) {
43+
const { message, type = 'info' } = params;
44+
// Send to Unity
45+
const response = await mcpUnity.sendRequest({
46+
method: toolName,
47+
params: {
48+
message,
49+
type
50+
}
51+
});
52+
if (!response.success) {
53+
throw new McpUnityError(ErrorType.TOOL_EXECUTION, response.message || `Failed to send message to Unity console`);
54+
}
55+
return {
56+
content: [{
57+
type: response.type,
58+
text: response.message
59+
}]
60+
};
61+
}

Server/build/tools/sendConsoleLogTool.js.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Server/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { createMenuItemTool } from './tools/menuItemTool.js';
77
import { createSelectGameObjectTool } from './tools/selectGameObjectTool.js';
88
import { createAddPackageTool } from './tools/addPackageTool.js';
99
import { createRunTestsTool } from './tools/runTestsTool.js';
10-
import { createNotifyMessageTool } from './tools/notifyMessageTool.js';
10+
import { createSendConsoleLogTool } from './tools/sendConsoleLogTool.js';
1111
import { createUpdateComponentTool } from './tools/updateComponentTool.js';
1212
import { createAddAssetToSceneTool } from './tools/addAssetToSceneTool.js';
1313
import { createGetMenuItemsResource } from './resources/getMenuItemResource.js';
@@ -46,7 +46,7 @@ createMenuItemTool(server, mcpUnity, toolLogger);
4646
createSelectGameObjectTool(server, mcpUnity, toolLogger);
4747
createAddPackageTool(server, mcpUnity, toolLogger);
4848
createRunTestsTool(server, mcpUnity, toolLogger);
49-
createNotifyMessageTool(server, mcpUnity, toolLogger);
49+
createSendConsoleLogTool(server, mcpUnity, toolLogger);
5050
createUpdateComponentTool(server, mcpUnity, toolLogger);
5151
createAddAssetToSceneTool(server, mcpUnity, toolLogger);
5252

Server/src/tools/notifyMessageTool.ts renamed to Server/src/tools/sendConsoleLogTool.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ import { McpUnityError, ErrorType } from '../utils/errors.js';
66
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
77

88
// Constants for the tool
9-
const toolName = 'notify_message';
10-
const toolDescription = 'Sends a message to the Unity console';
9+
const toolName = 'send_console_log';
10+
const toolDescription = 'Sends console log messages to the Unity console';
1111
const paramsSchema = z.object({
1212
message: z.string().describe('The message to display in the Unity console'),
1313
type: z.string().optional().describe('The type of message (info, warning, error) - defaults to info (optional)')
1414
});
1515

1616
/**
17-
* Creates and registers the Notify Message tool with the MCP server
17+
* Creates and registers the Send Console Log tool with the MCP server
1818
* This tool allows sending messages to the Unity console
1919
*
2020
* @param server The MCP server instance to register with
2121
* @param mcpUnity The McpUnity instance to communicate with Unity
2222
* @param logger The logger instance for diagnostic information
2323
*/
24-
export function createNotifyMessageTool(server: McpServer, mcpUnity: McpUnity, logger: Logger) {
24+
export function createSendConsoleLogTool(server: McpServer, mcpUnity: McpUnity, logger: Logger) {
2525
logger.info(`Registering tool: ${toolName}`);
2626

2727
// Register this tool with the MCP server

0 commit comments

Comments
 (0)