sendChat
Send chat messages to a Minecraft server using natural language commands, enabling seamless communication for AI-assisted in-game interactions.
Instructions
Send a chat message to the Minecraft server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Message to send to the server |
Implementation Reference
- src/tools/chat.ts:18-29 (handler)Handler function that implements the sendChat tool logic: validates connection, sends chat message using bot.chat, handles errors with appropriate responses.async ({ message }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { botState.bot.chat(message) return createSuccessResponse(`Message sent: ${message}`) } catch (error) { return createErrorResponse(error) } }
- src/tools/chat.ts:15-17 (schema)Input schema for sendChat tool defining 'message' as a string.{ message: z.string().describe('Message to send to the server'), },
- src/tools/chat.ts:12-30 (registration)Direct registration of the sendChat tool using server.tool, specifying name, description, schema, and inline handler.server.tool( 'sendChat', 'Send a chat message to the Minecraft server', { message: z.string().describe('Message to send to the server'), }, async ({ message }) => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { botState.bot.chat(message) return createSuccessResponse(`Message sent: ${message}`) } catch (error) { return createErrorResponse(error) } } )
- src/tools/index.ts:18-18 (registration)Invocation of registerChatTools() within the registerAllTools function, which registers all MCP tools including sendChat.registerChatTools()