Skip to main content
Glama
jimmcq

Lemonade Stand MCP Server

by jimmcq

sell_lemonade

Process daily sales transactions in the Lemonade Stand simulation to calculate revenue, manage inventory, and track business performance based on weather conditions and pricing strategies.

Instructions

Open for business and see today's results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gameIdYesThe game ID

Implementation Reference

  • The main handler function that executes the sell_lemonade tool logic: calculates recipe, potential customers, sales, revenue, costs, profit, updates inventory and game state.
    const handleSellLemonade = (gameState) => {
      const recipe = makeRecipe(gameState);
      const potentialCustomers = calculatePotentialCustomers(gameState.weather, gameState.pricePerCup);
      const actualSales = Math.min(potentialCustomers, recipe.maxCups);
      
      const revenue = actualSales * gameState.pricePerCup;
      const newInventory = {
        cups: gameState.inventory.cups - actualSales,
        lemons: gameState.inventory.lemons - recipe.lemonsUsed,
        sugar: gameState.inventory.sugar - recipe.sugarUsed,
        ice: 0 // ice melts every day
      };
    
      // Calculate the actual cost per cup based on recipe
      const actualCostPerCup = calculateCostPerCup();
      const dailyCost = actualSales * actualCostPerCup;
      const dailyProfit = revenue - dailyCost;
      
      return {
        success: true,
        dailyResults: {
          sales: actualSales,
          revenue: revenue,
          cost: dailyCost,
          profit: dailyProfit,
          costPerCup: actualCostPerCup,
          potentialCustomers: potentialCustomers,
          unsatisfiedCustomers: Math.max(0, potentialCustomers - actualSales)
        },
        gameState: {
          ...gameState,
          money: gameState.money + revenue, // Revenue is added, not profit
          inventory: newInventory,
          status: 'reporting'
        }
      };
    };
  • Input schema definition for the sell_lemonade tool, requiring gameId.
      name: "sell_lemonade",
      description: "Open for business and see today's results",
      inputSchema: {
        type: "object",
        properties: {
          gameId: { type: "string", description: "The game ID" }
        },
        required: ["gameId"]
      }
    },
  • server.js:351-368 (registration)
    MCP server registration and dispatch for sell_lemonade tool call, retrieves game state, invokes handler, updates state, and returns results.
    case 'sell_lemonade': {
      const sellGame = games.get(request.params.arguments?.gameId);
      if (!sellGame) {
        throw new McpError(ErrorCode.InvalidRequest, "Game not found");
      }
      
      const sellResult = handleSellLemonade(sellGame);
      if (sellResult.success) {
        games.set(request.params.arguments.gameId, sellResult.gameState);
      }
      
      return {
        content: [{
          type: "text",
          text: JSON.stringify(sellResult)
        }]
      };
    }
  • Helper function to compute the maximum cups that can be made from current inventory and ingredients used.
    const makeRecipe = (gameState) => {
      const cupsPerPitcher = 10;
      const lemonsPerPitcher = 4;
      const sugarPerPitcher = 4;
      const icePerPitcher = 15;
      
      const possiblePitchers = Math.min(
        Math.floor(gameState.inventory.lemons / lemonsPerPitcher),
        Math.floor(gameState.inventory.sugar / sugarPerPitcher),
        Math.floor(gameState.inventory.ice / icePerPitcher)
      );
      
      const maxCups = Math.min(
        possiblePitchers * cupsPerPitcher,
        gameState.inventory.cups
      );
      
      return {
        maxCups,
        lemonsUsed: Math.floor((maxCups / cupsPerPitcher) * lemonsPerPitcher),
        sugarUsed: Math.floor((maxCups / cupsPerPitcher) * sugarPerPitcher),
        iceUsed: Math.floor((maxCups / cupsPerPitcher) * icePerPitcher)
      };
    };
  • Helper function to calculate the cost per cup of lemonade based on ingredient prices.
    const calculateCostPerCup = () => {
      const prices = {
        cups: 0.05,
        lemons: 0.10,
        sugar: 0.08,
        ice: 0.02
      };
      
      const cupsPerPitcher = 10;
      const lemonsPerPitcher = 4;
      const sugarPerPitcher = 4;
      const icePerPitcher = 15;
      
      // Calculate cost of ingredients per pitcher
      const pitcherCost = 
        (lemonsPerPitcher * prices.lemons) + 
        (sugarPerPitcher * prices.sugar) + 
        (icePerPitcher * prices.ice);
      
      // Calculate cost per cup including the cup itself
      return (pitcherCost / cupsPerPitcher) + prices.cups;
    };
Behavior1/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but fails completely. It doesn't indicate whether this is a read or write operation, what side effects occur, what permissions are needed, or what the response contains. The metaphorical 'Open for business and see today's results' provides no concrete information about the tool's behavior beyond implying some kind of operational activity.

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

Conciseness2/5

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

While brief, the description is under-specified rather than appropriately concise. The single metaphorical sentence doesn't earn its place by providing useful information. It's front-loaded with unhelpful figurative language rather than functional description. This isn't conciseness but rather insufficient content.

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

Completeness1/5

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

Given no annotations, no output schema, and a metaphorical description that provides no functional information, this description is completely inadequate. For a tool with one parameter but unknown behavioral characteristics and return values, the description fails to provide the minimal context needed for an agent to understand what the tool does and how to use it effectively.

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?

The description adds no parameter information beyond what the schema provides. However, with 100% schema description coverage (the single parameter 'gameId' has a clear description), the baseline is 3. The description doesn't compensate for any gaps because there are none in the schema documentation, but it also doesn't add any value regarding parameter meaning or usage.

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

Purpose2/5

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

The description 'Open for business and see today's results' is vague and metaphorical rather than stating a clear purpose. It suggests starting operations and viewing outcomes, but doesn't specify what resource is being manipulated or what specific action is performed. This is a tautology that restates the tool name 'sell_lemonade' in figurative language rather than providing functional clarity.

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?

The description provides no guidance on when to use this tool versus its siblings (buy_supplies, next_day, set_price, start_game). There's no mention of prerequisites, sequencing, or alternatives. The metaphorical language doesn't help an agent understand the tool's role in the workflow or when it's appropriate to invoke it.

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