Skip to main content
Glama

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
NameRequiredDescriptionDefault
messageYesMessage to send to the server

Implementation Reference

  • 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)
      }
    }
  • Zod input schema for the sendChat tool defining the 'message' parameter.
    {
      message: z.string().describe('Message to send to the server'),
    },
  • 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)
        }
      }
    )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nacal/mcp-minecraft-remote'

If you have feedback or need assistance with the MCP directory API, please join our Discord server