Skip to main content
Glama

Suggest Recipe

suggest_recipe

Generate a beer recipe for a target style, including grain bill, hop schedule, yeast selection, and process parameters.

Instructions

Suggest a beer recipe for a target style. Returns grain bill, hop schedule, yeast selection, and process parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
styleYesTarget beer style for the recipe
batch_size_litresNoBatch size in litres

Implementation Reference

  • Registration of the suggest_recipe tool in the central tool registry.
    export function registerTools(server: McpServer): void {
      registerSearchStyles(server);
      registerSearchIngredients(server);
      registerDiagnoseOffFlavour(server);
      registerMatchWaterProfile(server);
      registerSuggestRecipe(server);
      registerPairingGuide(server);
    }
  • The main handler function that registers the suggest_recipe tool. Contains the entire tool logic: finding a style, selecting malts/hops/yeast/water, calculating grain weight, and returning a formatted recipe.
    export function registerSuggestRecipe(server: McpServer): void {
      server.registerTool(
        "suggest_recipe",
        {
          title: "Suggest Recipe",
          description:
            "Suggest a beer recipe for a target style. Returns grain bill, hop schedule, yeast selection, and process parameters.",
          inputSchema: {
            style: z.string().describe("Target beer style for the recipe"),
            batch_size_litres: z
              .number()
              .default(20)
              .describe("Batch size in litres"),
          },
        },
        async ({ style: styleQuery, batch_size_litres }) => {
          const matchedStyle = findStyle(styleQuery);
    
          if (!matchedStyle) {
            return {
              isError: true,
              content: [
                {
                  type: "text" as const,
                  text: `Could not find a style matching '${styleQuery}'. Try names like 'American IPA', 'Stout', 'Pilsner', or 'Hefeweizen'.`,
                },
              ],
            };
          }
    
          const { vitalStats: v } = matchedStyle;
          const ogTarget = (v.ogMin + v.ogMax) / 2;
          const ibuTarget = Math.round((v.ibuMin + v.ibuMax) / 2);
          const abvTarget = ((v.abvMin + v.abvMax) / 2).toFixed(1);
    
          const malts = selectMalts(matchedStyle.name, matchedStyle.category, matchedStyle.tags);
          const hops = selectHops(matchedStyle.name);
          const yeast = selectYeast(matchedStyle.name, matchedStyle.tags);
          const water = selectWater(matchedStyle.name);
    
          const totalGrainKg = calculateGrainWeight(ogTarget, batch_size_litres);
          // When specialty malts are present, hold base ≈ 85% and split the
          // remaining 15% across specialty grains. With no specialty (e.g. pale
          // styles like American IPA / Pilsner) the base malt provides 100%.
          const baseFraction = malts.specialty.length > 0 ? 0.85 : 1.0;
          const baseKg = (totalGrainKg * baseFraction).toFixed(2);
          const specialtyKg = malts.specialty.length > 0
            ? (totalGrainKg * 0.15 / malts.specialty.length).toFixed(2)
            : "0";
    
          // Determine mash temp based on style character
          const tags = matchedStyle.tags.join(" ").toLowerCase();
          const isDry = tags.includes("bitter") || tags.includes("hoppy") || matchedStyle.name.toLowerCase().includes("ipa");
          const mashTemp = isDry ? "65°C (149°F) — lower for drier finish" : "67°C (153°F) — higher for fuller body";
    
          // Yeast tempMin/tempMax are stored in °C (see src/data/yeasts.ts —
          // ales 18–23, lagers 9–15, kveik 25–40). Convert °C → °F for display.
          const fermTempFMin = Math.round(yeast.tempMin * 9 / 5 + 32);
          const fermTempFMax = Math.round(yeast.tempMax * 9 / 5 + 32);
          const fermTemp = `${yeast.tempMin}-${yeast.tempMax}°C (${fermTempFMin}-${fermTempFMax}°F)`;
    
          const lines: string[] = [
            `# Recipe: ${matchedStyle.name}`,
            `Batch size: ${batch_size_litres} litres | Target OG: ${ogTarget.toFixed(3)} | IBU: ${ibuTarget} | ABV: ~${abvTarget}%`,
            "",
            "## Grain Bill",
            `- ${malts.base.name}: ${baseKg} kg (base)`,
            ...malts.specialty.map((m) => `- ${m.name}: ${specialtyKg} kg (${m.type})`),
            "",
            "## Hop Schedule",
          ];
    
          if (hops.length >= 1) {
            const bitteringHop = hops.find((h) => h.purpose === "bittering" || h.purpose === "dual") ?? hops[0];
            lines.push(`- ${bitteringHop.name}: 60 min (bittering) — target ~${ibuTarget} IBU`);
            const aromaHop = hops.length > 1 ? hops[1] : hops[0];
            lines.push(`- ${aromaHop.name}: 5 min (aroma)`);
            if (isDry) {
              lines.push(`- ${aromaHop.name}: dry hop 3-5 days`);
            }
          }
    
          lines.push(
            "",
            "## Yeast",
            `- ${yeast.name} (${yeast.producer} ${yeast.code})`,
            `  Type: ${yeast.type} | Attenuation: ${yeast.attenuationMin}-${yeast.attenuationMax}%`,
            `  Flavour: ${yeast.flavourProfile}`,
            "",
            "## Process",
            `- Mash: ${mashTemp}`,
            "- Boil: 60 minutes",
            `- Fermentation: ${fermTemp}`,
            `- Conditioning: ${tags.includes("lager") ? "4-6 weeks cold conditioning" : "2 weeks at room temperature"}`,
          );
    
          if (water) {
            lines.push(
              "",
              "## Water",
              `- Target profile: ${water.name} (${water.city})`,
              `  Ca: ${water.calcium} | Mg: ${water.magnesium} | SO4: ${water.sulfate} | Cl: ${water.chloride}`,
            );
          }
    
          return {
            content: [
              {
                type: "text" as const,
                text: lines.join("\n"),
              },
            ],
          };
        },
      );
    }
  • Input schema for the suggest_recipe tool. Accepts a style string (required) and batch_size_litres (optional, default 20).
    inputSchema: {
      style: z.string().describe("Target beer style for the recipe"),
      batch_size_litres: z
        .number()
        .default(20)
        .describe("Batch size in litres"),
    },
  • Helper function to find a beer style by fuzzy-searching name and category fields.
    function findStyle(query: string) {
      const results = fuzzySearch(STYLES, query, ["name", "category"]);
      return results.length > 0 ? results[0] : null;
    }
  • Helper function that calculates the required grain weight in kg based on target OG, batch size, and mash efficiency.
    function calculateGrainWeight(
      ogTarget: number,
      batchLitres: number,
      efficiency: number = 0.72,
    ): number {
      // OG points: (OG - 1) * 1000. e.g. 1.065 → 65 gravity points per litre.
      const ogPoints = (ogTarget - 1) * 1000;
      // Total gravity-points needed across the whole batch (litre-points).
      const totalPoints = ogPoints * batchLitres;
      // Effective yield per kg of grain across the whole batch volume,
      // assuming a 37 PPG base malt at the given mash efficiency.
      // Result is in litre-points per kg of grain.
      const yieldPerKg = POINTS_PER_KG_PER_LITRE_AT_37_PPG * efficiency;
      return totalPoints / yieldPerKg;
    }
Behavior3/5

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

No annotations are provided, so the description carries full burden. It states the tool 'suggests' (non-mutating) and lists outputs, but lacks details on prerequisites, side effects, or deterministic behavior. Adequate but not exceptional.

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?

Single sentence, front-loaded with purpose, no redundant words. Efficiently communicates the tool's function and outputs.

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

Completeness4/5

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

For a simple tool with 2 parameters and no output schema, the description covers the returned components well. It could mention the default for batch_size_litres, but overall sufficient.

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 coverage is 100% with both parameters described. The description does not add additional meaning beyond the schema; it merely restates 'target style' and 'batch size.' Baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the tool's action: 'Suggest a beer recipe for a target style.' It specifies the outputs (grain bill, hop schedule, etc.) and distinguishes it from sibling tools like 'search_styles' or 'search_ingredients' which serve different purposes.

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

Usage Guidelines3/5

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

The description implies usage (when you want a recipe suggestion) but does not explicitly state when not to use it or provide alternative tools. Given siblings are distinct, an agent may infer correctly, but no explicit guidance is given.

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/gregario/brewers-almanack'

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