set_time
Change Minecraft world time using preset options like day, night, or custom tick values to control lighting and gameplay conditions.
Instructions
Set the world time. Presets: 'day' (1000), 'noon' (6000), 'sunset' (12000), 'night' (13000), 'midnight' (18000), 'sunrise' (23000). Or use a tick value.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time | Yes | Time value: 'day', 'noon', 'sunset', 'night', 'midnight', 'sunrise', or a tick number (0-24000) |
Implementation Reference
- src/tools/command-tools.ts:77-110 (handler)The "set_time" tool is registered and implemented in src/tools/command-tools.ts. It takes a time string (preset or tick value), resolves it to a tick number, and sends a "time set" command via RCON.
server.tool( "set_time", "Set the world time. Presets: 'day' (1000), 'noon' (6000), 'sunset' (12000), 'night' (13000), 'midnight' (18000), 'sunrise' (23000). Or use a tick value.", { time: z .string() .describe("Time value: 'day', 'noon', 'sunset', 'night', 'midnight', 'sunrise', or a tick number (0-24000)"), }, async ({ time }) => { const presets: Record<string, string> = { day: "1000", noon: "6000", sunset: "12000", night: "13000", midnight: "18000", sunrise: "23000", }; const value = presets[time.toLowerCase()] ?? time; try { const response = await manager.rcon.send(`time set ${value}`); return { content: [{ type: "text", text: response }] }; } catch (error) { return { content: [ { type: "text", text: `Failed: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } );