next_day
Advance to the next day in the Lemonade Stand game by submitting the game ID. Manage dynamic weather, pricing, and inventory for optimal business growth.
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 that executes the 'next_day' tool logic: advances the game day, generates new weather, resets ice inventory to 0, and sets game over if 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)Registration of the 'next_day' tool in the ListTools response, including 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)MCP CallToolRequest handler for 'next_day': retrieves game state, calls handleNextDay, updates games map, and returns result as JSON text content.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 for the 'next_day' tool: requires gameId string.inputSchema: { type: "object", properties: { gameId: { type: "string", description: "The game ID" } }, required: ["gameId"] }