# validate_recipe

> Validate an agent-drafted recipe before generating: structural checks, then a 1-row engine dry-run, then manifest.requires[] against the packs registered on…

Section: MCP · Type: tool · Last updated: 2026-09-13

Validate an agent-drafted recipe before generating: structural checks, then a 1-row engine dry-run, then manifest.requires[] against the packs registered on this machine. Returns { valid, next_step, errors, warnings, findings, redirections, missing_packs, engine_check }; findings holds every error and warning, each with a stable kind. Follow next_step verbatim — it says whether to re-draft, surface missing packs, or proceed to generate_from_graph. Pass depth:"preflight" to fold plan_packs and sample_world into this one call. When the recipe parses, studio says how the user can see it drawn — tables, links, rules — in the WorkLens studio; offer studio.how to the user once. Nothing is uploaded. A saved recipe: pass path, not its text.

## The picture

Agent (calls) → validate_recipe (Validate before generating) → Result (as data)

## Inputs

- coverage (string) — How much scenario_coverage says. 'brief' (default): each unaddressed scenario archetype as its id and title. 'full': also when each one matters and the syntax that declares it.
- depth (string) — 'structure' (default) — validation only, unchanged. 'preflight' — ALSO runs the pack plan and a 120-row sample world and returns them under preflight, so the three checks that gate a large run cost one round-trip instead of three. Only runs when the structure is valid.
- graph_json (string) — The drafted recipe as a JSON string. Give this or path, not both.
- path (string) — The saved recipe file on this machine (a .wl.json), as a full path. Preferred for a saved recipe: the server reads it, so nothing is copied into the call. Give this or graph_json, not both.

## When to call it

Four layers in one call: structural checks, a static satisfiability pass, the requirement ledger, and a 1-row in-memory engine dry-run.

Follow next_step verbatim. It tells you whether to re-draft, whether to re-read get_recipe_schema first, whether to surface missing packs, or whether to proceed to generation.

Two fields are easy to skim past and shouldn't be:

- declared_not_executed - requirements the recipe records that the engine will NOT execute. The recipe is an open superset: any requirement may be declared, and this is where the engine says what it will not do. Keys prefixed _ land here, as do keys naming a known-unsupported concept. - discovery_check.sequencing - "sealed" means the requirement list was fixed before the recipe was drafted; "self_declared" means it was written alongside, in which case a report of zero lost requirements is true by construction rather than by evidence.

## Example request

```json
{
  "_comment": "The shipped insurance-group recipe: 20 entities, 23 foreign keys, eight scenarios.",
  "name": "validate_recipe",
  "arguments": {
    "graph_json": {
      "project": "Suncorp-shaped general insurance group",
      "region": "AU",
      "seed": 20260826,
      "output": {
        "format": "csv"
      },
      "entities": [
        {
          "name": "Intermediary",
          "rows": 400,
          "fields": [
            {
              "name": "intermediary_id",
              "type": "id",
              "unique": true
            },
            {
              "name": "trading_name",
              "type": "company.name"
            },
            {
              "name": "abn",
              "_note": "Declared here rather than named from a pack: a checksum is a rule, and a rule belongs to the recipe. Same values either way.",
              "type_def": {
                "pattern": "N##########",
                "checksum": {
                  "algorithm": "weighted_mod",
                  "weights": [
                    10,
                    1,
                    3,
                    5,
                    7,
                    9,
                    11,
                    13,
                    15,
                    17,
                    19
                  ],
                  "modulus": 89,
                  "check_digit": "last",
                  "remainder_from": "zero",
                  "first_digit_offset": -1
                },
                "display": "## ### ### ###"
              }
            },
            {
              "name": "acn",
              "type_def": {
                "digits": 9,
                "checksum": {
                  "algorithm": "weighted_mod",
                  "weights": [
                    8,
                    7,
                    6,
                    5,
                    4,
                    3,
                    2,
                    1
                  ],
                  "modulus": 10,
                  "check_digit": "last"
                },
                "display": "### ### ###",
                "defects": {
                  "invalid": {
                    "at": 0,
                    "replace_with": "0",
                    "breaks": "checksum",
                    "note": "One digit off, so the mod-10 weighted sum fails."
                  }
             
```

Truncated for the page; the full request sits beside the tool’s schema in the repository.

## Example response

```json
{
  "valid": true,
  "contract_version": 3,
  "next_step": "Recipe is valid. FIRST show the user `declaration` — the recipe restated in plain English — plus `declaration.watch_for`, and get their confirmation: a valid recipe can still say the wrong thing. THEN call generate_from_graph and report the receipts it returns.",
  "declaration": {
    "declares": [
      "Intermediary: 400 rows, 11 columns",
      "  Intermediary.intermediary_id: an identifier, made by the engine",
      "  Intermediary.intermediary_id: never repeats",
      "  Intermediary.trading_name: a company name from the AU locale pack",
      "  Intermediary.abn: an identifier of its own shape, with a weighted mod check digit (mod 89), declared in the recipe",
      "  Intermediary.acn: an identifier of 9 digits, with a weighted mod check digit (mod 10), declared in the recipe",
      "  Intermediary.afs_licence_no: shaped like ######",
      "  Intermediary.intermediary_type: picks broker 45% · authorised_rep 30% · aggregator 10% · affinity_partner 15%",
      "  Intermediary.head_office_state: picks NSW 32% · VIC 26% · QLD 20% · WA 10% · SA 7% · TAS 2% · ACT 2% · NT 1%",
      "  Intermediary.remittance_bsb: an identifier of 4 part(s), with no check digit, declared in the recipe",
      "  Intermediary.remittance_account: a bank account number, made by the engine",
      "  Intermediary.remittance_account: marked \"sensitive\" (a sensitivity category of the recipe's own)",
      "  Intermediary.gst_registered: true or false, written \"Y\" and \"N\" · true 92% · false 8%",
      "  Intermediary.commission_rate_pct: between 5 and 22.5, spread evenly",
      "  Intermediary.commission_rate_pct: WHEN intermediary_type is \"aggregator\" → drawn between 2 and 8 (the first branch that matches wins)",
      "  Intermediary.commission_rate_pct: WHEN intermediary_type is \"affinity_partner\" → drawn between 10 and 30",
      "Quote: 9000 rows, 14 columns",
      "  Quote.quote_id: an identifier, made by the engine",
      "  Quote.quote_id: never repeats",
      "  Quote.quote_reference: shaped like QT-########",
      "  Quote.quote_reference: never repeats",
      "  Quote.intermediary_id: points at Intermediary.intermediary_id",
      "  Quote.brand: picks AAMI 38% · GIO 24% · Apia 14% · Shannons 10% · Bingle 14%",
      "  Quote.channel: picks direct_online 44% · call_centre 22% · comparison_ag
```

Truncated for the page; the full response sits beside the tool’s schema in the repository.

## Same step

- [sample_world](https://theworklens.com/docs/mcp/tools/sample-world): Generate a SMALL world (120 rows) and report what to check BEFORE paying for a large run. Catches what every other check passes: a declaration that is well-formed, satisfiable, and still constrains nothing. Findings are things to CHECK, not failures; clean: true says so explicitly. Call after validate_recipe, before…
- [Tool directory](https://theworklens.com/docs/mcp/tools): All 13 tools, grouped by step.

## Related

- [Tool directory](https://theworklens.com/docs/mcp/tools): All 13 tools the WorkLens MCP server exposes, grouped by the step they belong to, generated from the published contracts.
- [sample_world](https://theworklens.com/docs/mcp/tools/sample-world): Generate a SMALL world (120 rows) and report what to check BEFORE paying for a large run. Catches what every other check passes: a declaration that is…

_← Previous: [analyse_openapi](https://theworklens.com/docs/mcp/tools/analyse-openapi) · Next: [plan_packs](https://theworklens.com/docs/mcp/tools/plan-packs) →_

_README, input schema and the primary worked request and response for this tool, published with the server. Source: mcp-schemas/tools/04-validate_recipe._

_Canonical: https://theworklens.com/docs/mcp/tools/validate-recipe · This copy: https://theworklens.com/docs/mcp/tools/validate-recipe.md_
