inspect_workbook_contract
Validate a workbook’s native table against a declared contract before recipe preview or commit, checking headers, field types, grain, keys, and filters without inferring business meaning.
Instructions
Read-only full bounded native-table contract check; never infer business meaning.
Contract v1 requires version=1, name, source={table_name, optional sheet_name},
row_grain (a declaration), key_fields (logical names), and fields=[{name,
headers: [approved exact alternatives], type: string|number|integer|boolean,
nullable?: false, meaning?, allowed_values?, min?, max?}]. Optional min_rows
defaults to 1; filters use logical field names and Recipe predicates. Missing
or multiple matching headers are unresolved, never automatically selected.
Checks all source rows BEFORE filtering, excluding native totals. Declared
meanings are not verified facts. No coercion, formulas, dates, joins or code.
Limits: 32KB JSON, 32 fields, 8 aliases/field, 8 key fields, 20 filters,
50000 table cells/64 columns; sample_limit 1-5 affects row examples only.
Pass the same contract as workbook_contract to run_workbook_recipe to enforce
it in preview/commit; this inspection alone does not guard other tools.
Recovery: omit sample_limit for default 3 (never use Recipe's 10 here).
recipe_input_fields lists the exact logical names to use in Recipe inputs;
bindings values are physical headers for inspection, not Recipe field names.
For {name: "net", headers: ["NetSales"]}, use metrics.field="net", not
"NetSales". For {name: "currency", headers: ["Currency"]}, use
group_by=["currency"]. Metric as="Revenue" is an output label, not remapped.
Follow next_action: unresolved/violated requires an owner decision, not a
changed contract or filtered-out violation. Reuse the supplied filepath;
do not construct an absolute path by prefixing the client working directory.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contract | Yes | ||
| filepath | Yes | Reuse supplied server path; NEVER prepend client cwd. Rooted: relative OK; unrooted stdio: absolute, ask if missing. | |
| sample_limit | No |