Skip to main content
Glama
jimmcq

Lemonade Stand MCP Server

by jimmcq

buy_supplies

Purchase cups, lemons, sugar, and ice to manage inventory for a lemonade stand business simulation game.

Instructions

Purchase supplies for the lemonade stand

Input Schema

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

Implementation Reference

  • server.js:62-98 (handler)
    The main handler function for the buy_supplies tool. It calculates the total cost of purchases based on fixed item prices, updates the inventory and money in the game state if sufficient funds are available, and tracks purchase history.
    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 tool metadata including name, description, and input schema for validation of arguments (gameId required, optional quantities for cups, lemons, sugar, ice).
    {
      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)
    Registers and dispatches the buy_supplies tool call: validates game existence, invokes the handleBuySupplies function, persists updated game state, and returns the result as JSON.
    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)
        }]
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a transactional action ('purchase') but doesn't disclose effects like cost, inventory changes, success conditions, or error handling, which are critical for a purchase tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste, clearly front-loading the core purpose. It's appropriately sized for the tool's complexity, making it easy to scan and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's transactional nature, lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like what happens post-purchase, error cases, or integration with sibling tools, leaving significant gaps for agent usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters (gameId, cups, lemons, sugar, ice). The description adds no additional meaning beyond the schema, such as units for sugar/ice or purchase limits, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('purchase') and resource ('supplies for the lemonade stand'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'sell_lemonade' or 'set_price' beyond the obvious action difference, missing explicit distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description lacks context about prerequisites (e.g., needing a game started with 'start_game'), timing (e.g., before 'sell_lemonade'), or constraints, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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