next_day
Advance to the next day in the Lemonade Stand business simulation game to manage weather changes, adjust pricing strategies, and control inventory.
Instructions
Advance to the next day
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gameId | Yes | The game ID |
Implementation Reference
- server.js:206-230 (handler)Core handler function implementing the 'next_day' tool logic: advances the game day, generates new weather, resets ice inventory to 0 (melts daily), updates status to 'buying', or ends game after day 14.const handleNextDay = (gameState) => { if (gameState.day >= 14) { return { success: true, gameState: { ...gameState, status: 'gameOver' } }; } return { success: true, gameState: { ...gameState, day: gameState.day + 1, weather: generateWeather(), status: 'buying', inventory: { ...gameState.inventory, ice: 0 // ice melts daily } } }; };
- server.js:283-293 (registration)Tool registration in ListTools response, defining name, description, and input schema requiring gameId.{ name: "next_day", description: "Advance to the next day", inputSchema: { type: "object", properties: { gameId: { type: "string", description: "The game ID" } }, required: ["gameId"] } }
- server.js:370-387 (handler)Dispatch handler in CallToolRequestHandler switch statement: retrieves game state, calls handleNextDay, persists updated state, returns result as JSON.case 'next_day': { const nextDayGame = games.get(request.params.arguments?.gameId); if (!nextDayGame) { throw new McpError(ErrorCode.InvalidRequest, "Game not found"); } const nextDayResult = handleNextDay(nextDayGame); if (nextDayResult.success) { games.set(request.params.arguments.gameId, nextDayResult.gameState); } return { content: [{ type: "text", text: JSON.stringify(nextDayResult) }] }; }
- server.js:286-292 (schema)Input schema definition for 'next_day' tool, specifying required 'gameId' string parameter.inputSchema: { type: "object", properties: { gameId: { type: "string", description: "The game ID" } }, required: ["gameId"] }