Skip to main content
Glama

read-chat

Retrieve recent chat messages from Minecraft players to monitor in-game conversations and interactions.

Instructions

Get recent chat messages from players

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of recent messages to retrieve (default: 10, max: 100)

Implementation Reference

  • The asynchronous handler function for the 'read-chat' tool. It retrieves a specified number of recent chat messages from the messageStore (clamped to max), formats them with timestamps, usernames, and content, and returns a formatted response string using factory.createResponse.
    async ({ count = 10 }) => { const maxCount = Math.min(count, messageStore.getMaxMessages()); const messages = messageStore.getRecentMessages(maxCount); if (messages.length === 0) { return factory.createResponse("No chat messages found"); } let output = `Found ${messages.length} chat message(s):\n\n`; messages.forEach((msg, index) => { const timestamp = new Date(msg.timestamp).toISOString(); output += `${index + 1}. ${timestamp} - ${msg.username}: ${msg.content}\n`; }); return factory.createResponse(output); }
  • Zod schema definition for the optional 'count' input parameter (number, default 10, max 100).
    { count: z.number().optional().describe("Number of recent messages to retrieve (default: 10, max: 100)") },
  • Registers the 'read-chat' tool via factory.registerTool, including name, description, schema, and inline handler.
    factory.registerTool( "read-chat", "Get recent chat messages from players", { count: z.number().optional().describe("Number of recent messages to retrieve (default: 10, max: 100)") }, async ({ count = 10 }) => { const maxCount = Math.min(count, messageStore.getMaxMessages()); const messages = messageStore.getRecentMessages(maxCount); if (messages.length === 0) { return factory.createResponse("No chat messages found"); } let output = `Found ${messages.length} chat message(s):\n\n`; messages.forEach((msg, index) => { const timestamp = new Date(msg.timestamp).toISOString(); output += `${index + 1}. ${timestamp} - ${msg.username}: ${msg.content}\n`; }); return factory.createResponse(output); } );

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/yuniko-software/minecraft-mcp-server'

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