# Judge a rule from root facts, with its reasoning

One of montaye’s own rules, read from an official document and checked against the worked examples it prints, judged for the fields you give: us.resident_alien takes us.citizen, us.lawful_permanent_resident, the days present in the United States this year and the two before (IRS Pub 519’s green card and substantial presence tests) and us.closer_connection_exception (its closer connection exception). Not given, a standard of the law settles that one: as the days alone make it when the law draws the line (present 183 days or more this year, it does not hold), else as the standard says while nobody has judged the rest (not claimed on Form 8840, it does not hold), its reasoning on the step that reads it. The answer is true, false or unknown with the fields it waits on, each step of the reasoning with its arithmetic done exactly and how far it is from the line, the documents and pages it is read from, and what the rule leaves to a person (days that do not count, the first-year choice). Nothing you send is stored. GET /v1/status lists the rules. Fields are only ever added.

- REST: `POST https://montaye.com/v1/rules/evaluate` with `Authorization: Bearer <key>`
- MCP tool: `rule_evaluate` at https://montaye.com/mcp
- Answer: `{ "result": …, "usage": … }`; refusals are `application/problem+json`

## Refusals

- [`input_invalid`](https://montaye.com/refusals/input_invalid) (400): The request does not match the action’s input schema.
- [`not_found`](https://montaye.com/refusals/not_found) (404): No such action or document.
- [`rule_not_in_force`](https://montaye.com/refusals/rule_not_in_force) (422): The rule montaye publishes by that code states the law of other days: no revision of it is in force on the day asked.
- [`key_missing`](https://montaye.com/refusals/key_missing) (401): This action needs an API key (Authorization: Bearer <key>).
- [`key_invalid`](https://montaye.com/refusals/key_invalid) (401): The API key is unknown, revoked or expired.
- [`rate_limited`](https://montaye.com/refusals/rate_limited) (429): Too many requests from this client; slow down.
- [`plan_excludes_action`](https://montaye.com/refusals/plan_excludes_action) (403): The account’s plan does not include this action.
