run_checks
Gate a JSON document by running count-based checks and returning pass, fail, or inconclusive per expectation. Use it to verify expected match counts before trusting a file.
Instructions
Run deterministic checks — a query plus the count it expects — against a document; one verdict per check: pass, fail, or inconclusive (a | group or | distinct hit its 100,000-value cap, so the count is only a lower bound; never reported as a pass). Pass playbookPath for a jsonloupe playbook file, or checks inline. Playbook functions are JavaScript and are never run here. Expectations: {"type":"no-matches"}, {"type":"at-least-one"}, {"type":"exact-count","count":N}, {"type":"at-most","count":N}, {"type":"at-least","count":N}, {"type":"between","min":M,"max":N}. A check counts matches (groups/distinct values for | group / | distinct); value pipes like | sum are refused. A document that is not valid JSON is refused unless allowRepair is true. Failed and inconclusive checks list their first matched paths. Pass filePath for a one-call answer, or docId to reuse an open document. Use it to gate a document on counts you expect; for an open-ended count or breakdown use run_query.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| docId | No | A docId returned by load_doc. | |
| checks | No | Inline checks; use either this or playbookPath. | |
| filePath | No | File to open and check now instead of supplying docId. | |
| allowRepair | No | Check a document that is not valid JSON after repairing it (default false: refused, as a gate should not pass a broken file). | |
| maxEvidence | No | Paths per failed/inconclusive check (default 3). | |
| playbookPath | No | A jsonloupe playbook (.json) whose checks to run. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| hint | No | ||
| tool | Yes | ||
| error | No | ||
| evicted | No | ||
| structuredTruncated | No |