# plan_packs

> Turn a recipe into a pack requirement plan — and read the shelf off it: which packs are needed, which of those a pack on this machine already resolves (name,…

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

Turn a recipe into a pack requirement plan — and read the shelf off it: which packs are needed, which of those a pack on this machine already resolves (name, version, who reviewed it, expiry, SHA-256), which fields each satisfies, how many distinct values each must supply, and the fields that need no pack because the engine computes them. Call AFTER validate_recipe and BEFORE drafting a pack — it replaces guessing at size. It gives CAPACITY, not SHAPE: whether a name and a gender must agree is your judgement. Read coverage and unsatisfiable before trusting the plan.

## The picture

Agent (calls) → plan_packs (Packs) → Result (as data)

## Inputs

- graph_json (string, required) — The recipe as a JSON string.
- run_date (string) — Optional YYYY-MM-DD used to judge pack expiry on the shelf. Omit and freshness reads "unknown-run-date" rather than guessing.

## When to call it

Call this after validate_recipe and before drafting any pack. It replaces guessing at size, which is how a pack ends up with a hundred names for four rows, or forty for four hundred.

It tells you capacity, not shape. Deciding that a name and a gender must agree (one tables entry) while a name and a speciality need not (two pools) is a judgement about the world - yours to make, and to write down where a human can check it.

Always read coverage and unsatisfiable before trusting the plan. A plan that silently omits fields is worse than no plan.

## Example request

```json
{
  "_comment": "The bill-of-materials recipe planned for packs, with the shelf read off the plan as of a run date.",
  "name": "plan_packs",
  "arguments": {
    "graph_json": {
      "$schema": "https://theworklens.com/schema/recipe/v1.json",
      "version": 1,
      "project": "bike-assembly",
      "region": "NZ",
      "seed": 4242,
      "output": {
        "format": "csv"
      },
      "manifest": {
        "name": "bike-assembly",
        "version": "1.0.0",
        "owner": "worklens-reference",
        "domain": "manufacturing"
      },
      "entities": [
        {
          "name": "Part",
          "rows": 40,
          "fields": [
            {
              "name": "part_id",
              "type": "id",
              "unique": true
            },
            {
              "name": "part_name",
              "type": "enum",
              "values": [
                "Frame",
                "Fork",
                "Front wheel",
                "Rear wheel",
                "Chain",
                "Crankset",
                "Saddle",
                "Handlebar",
                "Brake caliper",
                "Derailleur"
              ]
            },
            {
              "name": "supplier_name",
              "type": "person.fullName"
            },
            {
              "name": "nhi",
              "type": "id",
              "unique": true
            },
            {
              "name": "kind",
              "type": "enum",
              "values": [
                "frame",
                "wheel",
                "drivetrain",
                "fitting"
              ],
              "weights": [
                10,
                25,
                25,
                40
              ]
            },
            {
              "name": "unit_cost",
              "type": "float",
              "min": 5,
              "max": 900,
              "shape": "long_tail"
            },
            {
              "name": "assembly_cost",
              "type": "float",
              "rollup": "sum(unit_cost)"
            }
          ],
          "graph": {
            "edges": "Assembly",
            "parent": "assembly_id",
            "child": "component_id",
            "qty": "quantity"
          }
        },
        {
          "name": "Assembly",
          "rows": 90,
          "fields": [
            {
              "n
```

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

## Example response

```json
{
  "contract_version": 3,
  "pack_groups": [
    {
      "token": "locale:nz.names",
      "roles": [
        "person.givenName"
      ],
      "satisfies": [
        "Part.supplier_name"
      ],
      "required_unique": 40,
      "hard": false,
      "why": "Part.rows=40 is the largest entity drawing on this. No field here is unique, so this is guidance, not a floor — fewer values simply repeat",
      "present": false,
      "repetition": "40 rows: expected repeats about 38% of rows from a pack of 40 distinct values, about 5% from 400. Repeats are allowed here; whether they matter is your call",
      "resolves_to": null,
      "resolution": "no pack on the shelf provides locale:nz.names"
    },
    {
      "token": "locale:nz.surnames",
      "roles": [
        "person.familyName"
      ],
      "satisfies": [
        "Part.supplier_name"
      ],
      "required_unique": 40,
      "hard": false,
      "why": "Part.rows=40 is the largest entity drawing on this. No field here is unique, so this is guidance, not a floor — fewer values simply repeat",
      "present": false,
      "repetition": "40 rows: expected repeats about 38% of rows from a pack of 40 distinct values, about 5% from 400. Repeats are allowed here; whether they matter is your call",
      "resolves_to": null,
      "resolution": "no pack on the shelf provides locale:nz.surnames"
    }
  ],
  "engine_satisfied": [
    {
      "field": "Part.part_id",
      "how": "unique row identifier, generated"
    },
    {
      "field": "Part.part_name",
      "how": "picked from the values the recipe itself lists"
    },
    {
      "field": "Part.nhi",
      "how": "unique row identifier, generated"
    },
    {
      "field": "Part.kind",
      "how": "picked from the values the recipe itself lists"
    },
    {
      "field": "Part.unit_cost",
      "how": "generated within min/max"
    },
    {
      "field": "Part.assembly_cost",
      "how": "totalled through the hierarchy (rollup)"
    },
    {
      "field": "Assembly.assembly_id",
      "how": "foreign key into Part.part_id — reuses existing rows, adds no demand"
    },
    {
      "field": "Assembly.component_id",
      "how": "foreign key into Part.part_id — reuses existing rows, adds no demand"
    },
    {
      "field": "Assembly.quantity",
      "how": "generated within min/max"
    }
  ],
  "unsatisfiable": [],
  "unclassified": [],

```

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

## Same step

- [register_pack](https://theworklens.com/docs/mcp/tools/register-pack): Hand a pack you drafted back to the engine so generation can use it — a locale pack (datasets for a region) or a rule fragment (one type_def or one skeleton_def, then referenced from recipes as "sha256:<hash>"); the engine reads the kind from the shape. This CLOSES the loop validate_recipe opens: when it reports…
- [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.
- [register_pack](https://theworklens.com/docs/mcp/tools/register-pack): Hand a pack you drafted back to the engine so generation can use it — a locale pack (datasets for a region) or a rule fragment (one type_def or one…

_← Previous: [validate_recipe](https://theworklens.com/docs/mcp/tools/validate-recipe) · Next: [register_pack](https://theworklens.com/docs/mcp/tools/register-pack) →_

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

_Canonical: https://theworklens.com/docs/mcp/tools/plan-packs · This copy: https://theworklens.com/docs/mcp/tools/plan-packs.md_
