Skip to main content
Glama
jimmcq
by jimmcq

buy_supplies

Purchase cups, lemons, sugar, and ice for your lemonade stand to manage inventory and optimize your business strategy in the Lemonade Stand simulation game.

Instructions

Purchase supplies for the lemonade stand

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cupsNoNumber of cups to buy
gameIdYesThe game ID
iceNoAmount of ice to buy
lemonsNoNumber of lemons to buy
sugarNoAmount of sugar to buy

Implementation Reference

  • server.js:62-98 (handler)
    Implements the core logic for buying supplies: calculates costs based on fixed prices, checks if enough money, updates inventory and money, records purchase.
    const handleBuySupplies = (gameState, purchases) => { const prices = { cups: 0.05, lemons: 0.10, sugar: 0.08, ice: 0.02 }; let totalCost = 0; const newInventory = { ...gameState.inventory }; const purchaseRecord = { ...purchases, date: gameState.day }; for (const item of ['cups', 'lemons', 'sugar', 'ice']) { const amount = purchases[item] || 0; const cost = amount * prices[item]; totalCost += cost; newInventory[item] += amount; purchaseRecord[`${item}Cost`] = cost; } if (totalCost > gameState.money) { return { success: false, message: "Not enough money!" }; } purchaseRecord.totalCost = totalCost; return { success: true, gameState: { ...gameState, money: gameState.money - totalCost, inventory: newInventory, purchaseHistory: [...gameState.purchaseHistory, purchaseRecord], status: 'pricing' } }; };
  • Defines the input schema for the buy_supplies tool, including gameId (required) and optional quantities for cups, lemons, sugar, ice.
    inputSchema: { type: "object", properties: { gameId: { type: "string", description: "The game ID" }, cups: { type: "number", description: "Number of cups to buy" }, lemons: { type: "number", description: "Number of lemons to buy" }, sugar: { type: "number", description: "Amount of sugar to buy" }, ice: { type: "number", description: "Amount of ice to buy" } }, required: ["gameId"] }
  • server.js:245-259 (registration)
    Registers the buy_supplies tool in the list of available tools with name, description, and input schema.
    { name: "buy_supplies", description: "Purchase supplies for the lemonade stand", inputSchema: { type: "object", properties: { gameId: { type: "string", description: "The game ID" }, cups: { type: "number", description: "Number of cups to buy" }, lemons: { type: "number", description: "Number of lemons to buy" }, sugar: { type: "number", description: "Amount of sugar to buy" }, ice: { type: "number", description: "Amount of ice to buy" } }, required: ["gameId"] } },
  • server.js:315-331 (registration)
    Handles incoming buy_supplies tool calls: retrieves game state, invokes handleBuySupplies, updates game state if successful, returns result.
    case 'buy_supplies': { const buyGame = games.get(request.params.arguments?.gameId); if (!buyGame) { throw new McpError(ErrorCode.InvalidRequest, "Game not found"); } const result = handleBuySupplies(buyGame, request.params.arguments); if (result.success) { games.set(request.params.arguments.gameId, result.gameState); } return { content: [{ type: "text", text: JSON.stringify(result) }] }; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jimmcq/Lemonade-Stand-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server