Skip to main content
Glama

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

NameRequiredDescriptionDefault
policyNo
environmentNo
principal_idYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.28

TDQS

A4.5/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, and the description carries the full burden well. It discloses sparse merge semantics, version bumping on every successful update, fail-closed 400 principal_inactive for tombstoned/disabled principals, 200 with inert:true for tombstones, 404 for cross-tenant principal IDs, and the error JSON shape (error, status, detail).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the read-vs-write split, then progressively deeper detail, which is the right order for a tool with two modes. It runs long and repeats the policy JSON example in both the body and the Args section, so a little trimming is possible without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter, dual-mode tool with no annotations and an output schema, the description covers everything an agent needs: mode selection, valid inputs, error conditions, and tombstone/tenancy edge cases. Nothing material is left to inference.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate, and it does for all three parameters. principal_id gets a format hint (prn_...), policy gets valid modes (allow, deny, require_grant, step_up, inherit), the inherit-to-remove semantics, and concrete examples, and environment gets its allowed values (dev, staging, prod) plus the exact effect on effective policy and provenance.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb pair and resource: 'Read or set one principal's sparse policy override (the top policy layer).' The 'top policy layer' framing vs. the middle layer folded in by the environment parameter makes the scope distinct. It stops short of naming the sibling tools that own the tenant/environment layers, so the agent must infer that routing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly branches usage on the policy argument: 'With policy empty: GET the override' vs. 'With policy given: PUT the override.' That is clear operational context for a dual-mode tool. There is no explicit statement about when to reach for a different policy tool instead (e.g. tenant-wide policy), so it falls short of the 'alternatives' bar.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.