Upload or replace OPA policy
opa_put_policyUpload a Rego policy under a given ID, replacing any existing policy. OPA compiles it on the server; invalid policies return errors and are not stored.
Instructions
Upload a Rego policy under the given ID. Replaces any existing policy with that ID; replaced says whether one existed. The policy is uploaded as raw text/plain and OPA compiles it on the server, so a policy that does not compile comes back as INVALID_REGO with OPA's errors, and nothing is stored.
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": {
"id": "<id>",
"source": "<source>"
},
"name": "opa_put_policy"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Policy ID to create or replace. | |
| source | Yes | Rego source. |