getServerInfo
Retrieve details about the currently connected Minecraft server, including status, players, and settings, enabling informed actions and management for remote gameplay.
Instructions
Get information about the currently connected server
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/info.ts:46-70 (registration)Registration of the getServerInfo tool using server.tool, including name, description, empty schema, and inline handler function.'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/info.ts:50-69 (handler)The handler function that implements the getServerInfo tool logic. It checks connection status, then returns server information including host, port, version, game mode, difficulty, time, player count, health, and food via createSuccessResponse.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) } } )