WorkLensDocs
    Studio
    tool

    generate_synthetic_data

    Generate realistic synthetic data from a recipe JSON. A recipe with several tables generates every table and replies like generate_from_graph (tables[] plus a…

    Last updated 2026-09-13 · Generated from mcp-schemas/tools/08-generate_synthetic_data · Markdown

    Summary

    Generate realistic synthetic data from a recipe JSON. A recipe with several tables generates every table and replies like generate_from_graph (tables[] plus a note). No real data involved. Deterministic when a seed is given. By default the CSV is WRITTEN LOCALLY (./worklens-output, or $WORKLENS_OUT_DIR) and you receive counts, receipts and a file handle with its SHA-256 — not the bulk rows. Use return_mode to change that.

    Agentcalls
    generate_synthetic_dataGenerate
    Resultas data

    Inputs and outputs

    Goes in
    • schema (string, required) — The recipe as a JSON string.
    • n_rows (number) — DEFAULT row count (≤ 10,000) for entities that declare no rows of their own — it does NOT override an entity that does, so a recipe stating its counts keeps them and its parent/child ratios. Omit it unless the recipe leaves rows unstated.
    • scenario (string) — Optional chaos scenario name.
    • seed (number | string) — Optional. A number pins the run — same recipe + seed + packs + engine = byte-identical (all in the receipt). "today" uses YYYYMMDD, so every run today matches and tomorrow differs. "now" gives a fresh dataset each run. Both are recorded in the receipt as the number they resolved to, so any…
    • recipe_path (string) — Optional: where the recipe file is saved (e.g. worklens/claims.wl.json). The run's lock file, <project>.lock, is written beside it. Without it, the lock goes to the project's worklens/ folder.
    • return_mode (string) — 'metadata' (default) — file handle + receipts, no rows; 'preview' — plus the first 5 rows so you can show the user what the data looks like; 'full' — inline CSV, at most 50 rows. 'preview' and 'full' ask the PERSON first, in their client; without their yes (or a client that cannot ask) the…

    When to call it

    The single-schema entry point: a recipe JSON string. No recipe ships with WorkLens, so none is named by id. Same metadata-first behaviour as generate_from_graph.

    On seed: a number pins the run forever. "today" resolves to YYYYMMDD, so every run today matches and tomorrow differs. "now" gives a fresh dataset each run. Both are recorded in the receipt as the number they resolved to, so any run stays reproducible. Omitting it is not the same as passing 42 - the engine default cannot be reproduced by passing a number.

    Example request

    {
      "_comment": "A one-table invoice recipe: the DEFAULT mode - receipts and a file handle, no rows.",
      "name": "generate_synthetic_data",
      "arguments": {
        "schema": {
          "pack_manifest": {
            "name": "au-invoice",
            "version": "1.0.0",
            "provides": [
              "domain:au-invoice"
            ],
            "owner": "worklens"
          },
          "project": "au-invoice",
          "region": "AU",
          "entities": [
            {
              "name": "invoice",
              "rows": 50,
              "fields": [
                {
                  "name": "invoice_id",
                  "type": "id",
                  "unique": true
                },
                {
                  "name": "abn",
                  "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": "## ### ### ###",
                    "defects": {
                      "invalid": {
                        "at": 1,
                        "replace_with": "0",
                        "breaks": "checksum",
                        "note": "One digit off, so the mod-89 sum fails. Declared here rather than written into the engine."
                      }
                    }
                  },
                  "sensitivity": "pii"
                },
                {
                  "name": "customer_name",
                  "type": "person.fullName",
                  "sensitivity": "pii"
                },
                {
                  "name": "billing_address",
                  "type": "address.full",
                  "sensitivity": "pii"
                },
                {
                  "name": "issue_date",
                  "type": "date"
                },
                {
                  "name": "subtotal",
                  "type": "finance.amount",
                  "min": 50,
                  "max": 5000
                },
                {
                  "name": "gst",
                  "type": "finance.amount",
                  "derive": "

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

    Example response

    {
      "status": "completed",
      "contract_version": 3,
      "return_mode": "metadata",
      "rows_generated": 5,
      "constraints_report": [],
      "defects_report": [],
      "distributions_report": [],
      "flows_report": [],
      "hierarchy_report": [],
      "unique_report": [
        {
          "columns": [
            "invoice_id"
          ],
          "entity": "invoice",
          "kept_duplicates": 0,
          "rows_checked": 5,
          "scenario_expected": false
        }
      ],
      "files": [
        {
          "name": "au-invoice.csv",
          "path": "<WORKLENS_OUT_DIR>/au-invoice.csv",
          "sha256": "2302b8143efec9ee3175a57779d372a6e746704775b1fb31619c625fd9840052",
          "bytes": 646
        }
      ],
      "evidence": {
        "name": "au-invoice.worklens-evidence.json",
        "path": "<WORKLENS_OUT_DIR>/au-invoice.worklens-evidence.json",
        "sha256": "4f180adfd987078897bf5eb06164cbf22d42a88886ed7064f1811c09d7eff8ef",
        "bytes": 6205,
        "binding_sha256": "50f1b555f9c42bb426801b58311995e74878ad61ba1b316a743f4fc33db08866"
      },
      "data_returned_to_agent": false
    }

    Same step