sendChat
Send chat messages to a Minecraft server from an AI assistant. This tool enables communication with players and the server through text commands.
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)The handler function that executes the sendChat tool logic: checks connection, sends chat message via bot.chat(), handles success/error 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)Zod input schema for the sendChat tool defining the 'message' parameter.{ message: z.string().describe('Message to send to the server'), },
- src/tools/chat.ts:12-30 (registration)Registration of the 'sendChat' tool using server.tool, including name, description, schema, and 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) } } )