writ_policy_principal
Read or set a principal's sparse policy override, including environment-aware effective policy and provenance, or remove individual verb overrides by setting them to inherit.
Instructions
Read or set one principal's sparse policy override (the top policy layer).
With policy empty: GET the override. Returns the gate payload verbatim - the sparse override in policy (only the verbs it explicitly sets; empty with version 0 when never configured), effectivePolicy it resolves to, and policyProvenance naming the winning layer (principal, environment, or tenant) per verb. Pass environment to fold that environment's override into the middle layer, exactly as a check naming it would evaluate. Tombstoned principals still return 200 with "inert": true - they stay resolvable forever, but their override never supplies a mode while the principal is deleted or disabled. A principalId from another tenant is 404.
With policy given: PUT the override. Pass a JSON object string of verb to mode, e.g. '{"refund": "step_up"}'. Modes: allow, deny, require_grant, step_up, and inherit - sending {"refund": "inherit"} removes that verb from the principal's override so it inherits downward again. The override is sparse: only the verbs you send are stored, and every successful update bumps the override's version by one. Fail closed: configuring policy on a tombstoned or disabled principal is 400 (principal_inactive); an identity that cannot authorize checks cannot carry policy either.
Args: principal_id: The principal (prn_...) whose override to read or set. policy: JSON object string of verbs to modes, e.g. '{"refund": "step_up"}'. Empty string (default) reads instead. Bad JSON, unknown verbs, or unknown modes return an error JSON without calling the gate. environment: Optional dev, staging, or prod for the read; appends ?environment= so the effective policy and provenance fold that environment's override into the middle layer. Anything else returns an error JSON without calling the gate.
Returns the gate payload verbatim on success; on failure an error JSON with error, status, and detail.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"principal_id": "<principal_id>"
},
"name": "writ_policy_principal"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy | No | ||
| environment | No | ||
| principal_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |