# 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…

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

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 generate_from_graph.

## The picture

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

## Inputs

- graph_json (string, required) — The recipe as a JSON string.
- seed (number | string) — Optional. A number pins the run — same recipe + same seed = byte-identical, forever. "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 run stays reproducible.…
- scenario (string) — Optional scenario to sample under. Omit for the default run.

## When to call it

Run this after validate_recipe and before generate_from_graph. It catches the class every other check passes: a declaration that is well-formed, satisfiable, uses a real capability, and still constrains nothing.

The measurement it exists for: a hospital recipe declaring that an appointment happens at its doctor's clinic validated, generated 1,800 rows, passed its proof at realism 90, and reported 1800/1800 scoped, 0 unsatisfiable — while 1,362 appointments were at the wrong clinic, because the scope as written restated its own foreign key.

Findings are things to check, not failures. clean: true is stated explicitly, because an empty array and "did not look" read identically otherwise. declarations lists requirements the recipe records that the engine does not execute.

## Example request

```json
{
  "_comment": "The clinic recipe: a vacuous scope, an unconstrained self-ref and a contradicted `expect`.",
  "name": "sample_world",
  "arguments": {
    "graph_json": {
      "$schema": "https://theworklens.com/schema/recipe/v1.json",
      "version": 1,
      "project": "clinic-network",
      "region": "AU",
      "seed": 20260901,
      "output": {
        "format": "csv"
      },
      "manifest": {
        "name": "clinic-network",
        "version": "1.0.0",
        "owner": "worklens-reference",
        "domain": "healthcare"
      },
      "discovery": {
        "sealed": [
          "foreign-key",
          "cross-entity-agreement",
          "ordered-timestamps",
          "state-machine",
          "composite-unique-key",
          "computed-column",
          "columns-that-must-agree",
          "skewed-parent-child-counts",
          "real-world-value-kind",
          "checksum-validated-identifier",
          "data-quality-machinery",
          "conditional-field",
          "numeric-threshold",
          "segment-specific-ranges",
          "category-drives-behaviour",
          "recursive-structure",
          "stored-total",
          "money-or-skewed-numbers",
          "reproducible-fixture",
          "known-bad-case",
          "volume-sensitive-path",
          "elapsed-time-threshold",
          "seasonality",
          "regulated-identifier"
        ],
        "observed": [
          {
            "evidence": "foreign-key",
            "where": "bookings.clinician_id",
            "note": "every booking belongs to one clinician"
          },
          {
            "evidence": "cross-entity-agreement",
            "where": "booking vs clinician site",
            "note": "a booking happens at the site its clinician works from"
          },
          {
            "evidence": "ordered-timestamps",
            "where": "booking lifecycle",
            "note": "requested <= starts <= ends"
          },
          {
            "evidence": "state-machine",
            "where": "booking.status",
            "note": "held -> confirmed -> attended, with cancelled/no_show as exits"
          },
          {
            "evidence": "composite-unique-key",
            "where": "no double-booking",
            "note": "(clinician_id, starts_on) is unique"
          },
          {
            "evidence": "computed-column",
            "where": 
```

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

## Example response

```json
{
  "contract_version": 3,
  "schema": "worklens.sample_world.v1",
  "rows_per_entity": [
    [
      "Site",
      12
    ],
    [
      "Clinician",
      30
    ],
    [
      "Patient",
      200
    ],
    [
      "Booking",
      600
    ],
    [
      "Invoice",
      600
    ],
    [
      "PatientRecord",
      200
    ]
  ],
  "findings": [
    {
      "kind": "unconstrained_self_reference",
      "entity": "Site",
      "field": "parent_site_id",
      "detail": "`parent_site_id` points at another row of Site with nothing narrowing the choice, so it lands on an arbitrary row.",
      "matters": "If this link carries a business relationship — a replacement, a correction, a prior version — the two rows will not agree on what that relationship implies. Add a `scope` naming the column they must share."
    },
    {
      "kind": "expectation_contradicted",
      "entity": "Clinician",
      "field": "consult_fee",
      "detail": "`params_when` condition `speciality = paediatrics` is declared `expect: \"not_exercised\"` and matched 2 row(s).",
      "matters": "Either the data moved under a rule nobody revisited, or the expectation was wrong when it was written. Both are worth knowing; neither is visible without this line."
    }
  ],
  "declarations": [],
  "clean": false
}
```

## Same step

- [validate_recipe](https://theworklens.com/docs/mcp/tools/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 this machine. Returns { valid, next_step, errors, warnings, findings, redirections, missing_packs, engine_check }; findings holds every error and warning, each…
- [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.
- [validate_recipe](https://theworklens.com/docs/mcp/tools/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…

_← Previous: [verify_world](https://theworklens.com/docs/mcp/tools/verify-world) · Next: [prove_recipe](https://theworklens.com/docs/mcp/tools/prove-recipe) →_

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

_Canonical: https://theworklens.com/docs/mcp/tools/sample-world · This copy: https://theworklens.com/docs/mcp/tools/sample-world.md_
