send_message
Send chat messages to Minecraft Bedrock players via the MCP server. Enables clear communication for build progress, instructions, or updates during gameplay.
Instructions
Send a chat message to the connected Minecraft player. ALWAYS provide a message parameter. Use this to communicate with the player about build progress or instructions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | The text message to send to the player (REQUIRED - never call this without a message) |
Implementation Reference
- src/server.ts:404-439 (registration)Registration of the 'send_message' MCP tool, including Zod input schema and async handler that delegates to server.sendMessage and returns formatted response.this.mcpServer.registerTool( "send_message", { title: "Send Message", description: "Send a chat message to the connected Minecraft player. ALWAYS provide a message parameter. Use this to communicate with the player about build progress or instructions.", inputSchema: { message: z .string() .describe( "The text message to send to the player (REQUIRED - never call this without a message)" ), }, }, async ({ message }: { message: string }) => { const result = await this.sendMessage(message || "Hello from MCP server!"); let responseText: string; if (result.success) { responseText = result.message || "Message sent successfully"; } else { // エラーメッセージにヒントを追加 const errorMsg = result.message || "Failed to send message"; responseText = `❌ ${enrichErrorWithHints(errorMsg)}`; } return { content: [ { type: "text", text: responseText, }, ], }; } );
- src/server.ts:592-613 (handler)Core handler method that sends the message to the current Minecraft world/player, with connection checks, logging, and error handling.public async sendMessage(text: string): Promise<ToolCallResult> { if (!this.currentWorld) { if (process.stdin.isTTY !== false) { console.error("エラー: プレイヤーが接続されていません"); } return { success: false, message: "No player connected" }; } try { if (process.stdin.isTTY !== false) { console.error(`メッセージ送信: ${text}`); } await this.currentWorld.sendMessage(text); return { success: true, message: "Message sent successfully" }; } catch (error) { if (process.stdin.isTTY !== false) { console.error("メッセージ送信エラー:", error); } return { success: false, message: `Failed to send message: ${error}` }; } }
- src/server.ts:406-416 (schema)Input schema for the 'send_message' tool: requires a string 'message' validated with Zod.{ title: "Send Message", description: "Send a chat message to the connected Minecraft player. ALWAYS provide a message parameter. Use this to communicate with the player about build progress or instructions.", inputSchema: { message: z .string() .describe( "The text message to send to the player (REQUIRED - never call this without a message)" ), },