{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/webrix/main/json-schema/webrix-update-enforcement-policy-request-schema.json",
  "title": "UpdateEnforcementPolicyRequest",
  "description": "At least one field must be provided. When `rules` is present it replaces the entire ordered rule set.\n",
  "x-generated": "2026-10-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/webrix-api-openapi.json#/components/schemas/UpdateEnforcementPolicyRequest",
  "type": "object",
  "properties": {
    "mcp_servers": {
      "type": "string",
      "enum": [
        "allow",
        "warn",
        "block"
      ],
      "description": "Default action for discovered MCP servers when no rule matches"
    },
    "skills": {
      "type": "string",
      "enum": [
        "allow",
        "warn",
        "block"
      ],
      "description": "Default action for discovered skills when no rule matches"
    },
    "capability_names": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Maps identity hashes to human-readable display names used in rules"
    },
    "rules": {
      "type": "array",
      "description": "Full ordered set of rules to store (replaces existing rules)",
      "items": {
        "type": "object",
        "required": [
          "name",
          "pattern",
          "match_field",
          "target",
          "action"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Existing rule id; omit to create a new rule"
          },
          "name": {
            "type": "string"
          },
          "pattern": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "match_field": {
            "type": "string",
            "enum": [
              "hash",
              "all_unmanaged"
            ]
          },
          "target": {
            "type": "string",
            "enum": [
              "mcp_server",
              "skill",
              "all"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "allow",
              "warn",
              "block"
            ]
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "active"
            ],
            "default": "active"
          },
          "scope_type": {
            "type": "string",
            "enum": [
              "all",
              "group",
              "user",
              "device"
            ]
          },
          "scope_id": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "scope_name": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "agents": {
            "oneOf": [
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "AI agents (source applications) the rule is limited to. Omit or send null to apply the rule to every agent."
          }
        }
      }
    }
  }
}