get_world_info
Retrieve world details from Minecraft server level.dat files, including seed, spawn coordinates, game type, and version information for server administration.
Instructions
Get detailed information about a world from its level.dat file, including seed, spawn point, game type, and version.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| world_name | Yes | World folder name (e.g., 'world') |
Implementation Reference
- src/tools/world-tools.ts:45-99 (handler)The 'get_world_info' tool is defined here, with its input schema and handler logic. It retrieves world information using the worldManager service.
// --- Get World Info --- server.tool( "get_world_info", "Get detailed information about a world from its level.dat file, including seed, spawn point, game type, and version.", { world_name: z.string().describe("World folder name (e.g., 'world')"), }, async ({ world_name }) => { const info = await worldManager.getWorldInfo(world_name); if (!info) { return { content: [ { type: "text", text: `World "${world_name}" not found.` }, ], isError: true, }; } const structure = worldManager.getWorldStructure(world_name); const size = worldManager.getWorldSize(world_name); const datapacks = worldManager.listDataPacks(world_name); const gameTypes = ["Survival", "Creative", "Adventure", "Spectator"]; const difficulties = ["Peaceful", "Easy", "Normal", "Hard"]; const lines = [ `World: ${info.levelName} (${world_name})`, `Version: ${info.version ?? "Unknown"}`, `Data Version: ${info.dataVersion ?? "Unknown"}`, `Size: ${size.toFixed(1)} MB`, ``, `--- Generation ---`, `Seed: ${info.seed}`, `Game Type: ${gameTypes[info.gameType] ?? info.gameType}`, `Difficulty: ${difficulties[info.difficulty] ?? info.difficulty}`, `Hardcore: ${info.hardcore}`, ``, `--- Spawn Point ---`, `X: ${info.spawnX}, Y: ${info.spawnY}, Z: ${info.spawnZ}`, ``, `--- Time ---`, `Day Time: ${info.dayTime} ticks (Day ${Math.floor(info.dayTime / 24000)})`, `Last Played: ${info.lastPlayed > 0 ? new Date(Number(info.lastPlayed)).toISOString() : "Unknown"}`, ``, `--- Structure ---`, ...Object.entries(structure).map( ([name, exists]) => ` ${exists ? "✅" : "❌"} ${name}` ), ``, `--- Data Packs ---`, datapacks.length > 0 ? datapacks.join(", ") : "None", ]; return { content: [{ type: "text", text: lines.join("\n") }] }; } );