getServerInfo
Retrieve current server details including connection status, version, and available features for managing Minecraft gameplay remotely.
Instructions
Get information about the currently connected server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/info.ts:49-68 (handler)The asynchronous handler function that executes the logic for the getServerInfo tool. It verifies bot connection and returns detailed server and bot status information.async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { return createSuccessResponse(`Server Info: Host: ${botState.connectionInfo.host} Port: ${botState.connectionInfo.port} Version: ${botState.bot.version} Game Mode: ${botState.bot.game.gameMode} Difficulty: ${botState.bot.game.difficulty} Time: ${botState.bot.time.timeOfDay} Players Online: ${Object.keys(botState.bot.players).length} Your Health: ${botState.bot.health ? botState.bot.health.toFixed(1) : 'N/A'} Your Food: ${botState.bot.food ? botState.bot.food.toFixed(1) : 'N/A'}`) } catch (error) { return createErrorResponse(error) } }
- src/tools/info.ts:44-69 (registration)The server.tool() call that registers the getServerInfo tool, including its name, description, empty schema object, and inline handler function.// Tool to get server information server.tool( 'getServerInfo', 'Get information about the currently connected server', {}, async () => { if (!botState.isConnected || !botState.bot) { return createNotConnectedResponse() } try { return createSuccessResponse(`Server Info: Host: ${botState.connectionInfo.host} Port: ${botState.connectionInfo.port} Version: ${botState.bot.version} Game Mode: ${botState.bot.game.gameMode} Difficulty: ${botState.bot.game.difficulty} Time: ${botState.bot.time.timeOfDay} Players Online: ${Object.keys(botState.bot.players).length} Your Health: ${botState.bot.health ? botState.bot.health.toFixed(1) : 'N/A'} Your Food: ${botState.bot.food ? botState.bot.food.toFixed(1) : 'N/A'}`) } catch (error) { return createErrorResponse(error) } } )
- src/tools/index.ts:27-28 (registration)Call to registerInfoTools() within the registerAllTools() function, which indirectly registers the getServerInfo tool.// Information tools registerInfoTools()