set_price
Adjust the cost per cup of lemonade in the Lemonade Stand business simulation to optimize revenue based on weather conditions and customer demand.
Instructions
Set the price per cup of lemonade
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gameId | Yes | The game ID | |
| price | Yes | Price per cup in dollars |
Implementation Reference
- server.js:333-349 (handler)Handler for the 'set_price' tool. Retrieves the game state, validates existence, updates pricePerCup from arguments, sets status to 'selling', persists the state, and returns success with updated game state.case 'set_price': { const priceGame = games.get(request.params.arguments?.gameId); if (!priceGame) { throw new McpError(ErrorCode.InvalidRequest, "Game not found"); } priceGame.pricePerCup = parseFloat(request.params.arguments.price); priceGame.status = 'selling'; games.set(request.params.arguments.gameId, priceGame); return { content: [{ type: "text", text: JSON.stringify({ success: true, gameState: priceGame }) }] }; }
- server.js:260-271 (registration)Tool registration in ListTools response, including name, description, and input schema for 'set_price'.{ name: "set_price", description: "Set the price per cup of lemonade", inputSchema: { type: "object", properties: { gameId: { type: "string", description: "The game ID" }, price: { type: "number", description: "Price per cup in dollars" } }, required: ["gameId", "price"] } },
- server.js:263-270 (schema)Input schema definition for the 'set_price' tool, specifying gameId (string, required) and price (number, required).inputSchema: { type: "object", properties: { gameId: { type: "string", description: "The game ID" }, price: { type: "number", description: "Price per cup in dollars" } }, required: ["gameId", "price"] }