{"uid":"cap_mAJiyIPmOgqDYy7H4cqEC","slug":"writerslogic-cross-field-rules-validator-1df04f7d","name":"WritersLogic Cross-Field Rules Validator","description":"Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.","url":"https://agents.writerslogic.com/api/v1/cross-field-rules?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"data":{"description":"The JSON document the rules apply to."},"rules":{"type":"array","items":{"type":"object","required":["id","kind"],"properties":{"as":{"enum":["auto","number","decimal","date","datetime","string"],"type":"string"},"id":{"type":"string","maxLength":80},"op":{"enum":["==","!=",">",">=","<","<="],"type":"string"},"kind":{"enum":["compare","required-if","forbidden-if","exactly-one","at-most-one","at-least-one","all-or-none","sum-equals"],"type":"string"},"left":{"type":"string","maxLength":300,"description":"JSON pointer; * matches every array element."},"when":{"type":"object","required":["path","op"],"properties":{"op":{"enum":["equals","not-equals","in","not-in","present","absent","empty"],"type":"string"},"path":{"type":"string","maxLength":300},"value":{"description":"Operand for equals, not-equals, in, not-in."}},"additionalProperties":false},"right":{"type":"string","maxLength":300,"description":"JSON pointer compared with left (use value for a constant)."},"total":{"type":"string","maxLength":300},"value":{"description":"Constant to compare with, or the expected total."},"fields":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":50},"forbid":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":20},"require":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":20},"presence":{"enum":["defined","non-null","non-empty"],"type":"string","description":"What counts as present: defined (key exists), non-null (default), non-empty."},"tolerance":{"type":"string","maxLength":40,"description":"Decimal tolerance for sum-equals, default 0."}},"additionalProperties":false},"maxItems":100,"minItems":1},"onMissing":{"enum":["unknown","fail","skip"],"type":"string","description":"Missing or null compare operand: unknown (default), fail or skip."}}},"responseSchema":{"type":"json"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_wy_8GSua2aqaxn1XymWbQ","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Evaluates up to 100 declarative cross-field rules over a JSON document and reports pass, fail, or unknown per rule with violating field pointers and value classes","exampleAgentPrompt":"Check these invoice records against my cross-field rules: require that 'due_date' is after 'issue_date', that 'subtotal' plus 'tax' equals 'total' within 0.01, and that if 'discount_code' is present then 'discount_amount' must also be present — report which rules pass, fail, or are unknown and show me any violating field paths.","exampleUseCases":[{"title":"Invoice line-item sum validation","prompt":"I have a JSON invoice with line items that each have 'quantity' and 'unit_price', and a top-level 'grand_total'. Validate that the sum of all line item amounts equals the grand_total within a tolerance of 0.005, and that every line item's 'end' date is after its 'start' date."},{"title":"Conditional field presence enforcement","prompt":"I'm processing a loan application JSON — if 'employment_type' equals 'self-employed' then 'tax_return_url' must be present and non-empty, and if 'has_co_applicant' is true then 'co_applicant_name' and 'co_applicant_ssn' are both required. Can you run those conditional presence rules and tell me which ones fail?"},{"title":"Mutually exclusive option group check","prompt":"Validate this order JSON: exactly one of 'pickup_location', 'delivery_address', or 'locker_id' must be present and non-null — no more, no less. Also check that 'requested_at' is before 'scheduled_for'. Show me any violations with the actual field paths."}],"resultDescription":"A per-rule evaluation report listing each rule's ID and outcome (pass, fail, or unknown), along with the JSON Pointer of every violating field and the value class of the offending operand (absent, null, empty string, or value). Rules involving array wildcards report results per array element. Missing operands are reported as unknown, fail, or skipped depending on the onMissing setting.","failureModes":["Exceeding 100 rules returns a validation error","Malformed JSON Pointer syntax in left/right/fields causes rule to error","sum-equals with non-numeric field values fails to compute","A wildcard (*) path on a non-array field yields unknown or empty results","Missing 'kind' or 'id' on any rule object causes request rejection","Requesting 'decimal' comparison on non-decimal-representable values may yield unknown","onMissing not set defaults to unknown which may be unexpected for strict validation flows"],"whenToPreferThis":"Use this endpoint when you need to enforce cross-field business logic that goes beyond per-field JSON Schema validation — such as conditional presence, mutual exclusion, numeric ordering across fields, exact decimal sums, or date ordering on array elements. It is especially well-suited for AI agents validating structured tool arguments or records where rules need to be declared as data rather than code, and where you need precise, non-conflated reporting of absent vs null vs empty field states.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-19T06:38:12.959Z","isFirstParty":false,"canonicalSlug":"writerslogic-cross-field-rules-validator-1df04f7d"}