Replace targeting rules
update_targetingReplace all targeting rules for a flag in one environment, with optional ifMatch protection to prevent overwriting concurrent changes.
Instructions
REPLACE all targeting rules of a flag in one environment (full PUT — rules not included are removed). Rules are evaluated in order. Get the current rules first with get_targeting. Pass ifMatch (the etag from get_targeting) so rules someone else changed meanwhile are not overwritten.
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": {
"project": "<project>",
"flag": "<flag>",
"environment": "<environment>",
"rules": "<rules>"
},
"name": "update_targeting"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flag | Yes | Flag key or id | |
| rules | Yes | The complete ordered rule list; rules left out are deleted | |
| reason | No | Why you are making this change. Recorded in the audit log, and required when the environment (or, for project-wide changes, any environment in the project) is marked critical. | |
| ifMatch | No | etag from get_targeting. The write is refused with 412 if the resource changed since that read; re-read and re-apply. Omit to write unconditionally. | |
| project | Yes | Project key | |
| environment | Yes | Environment key, e.g. production | |
| freeze_override | No | Owner/Admin only: break an active change freeze for this one change. Requires `reason`. Use it only after a change_frozen error says can_override is true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| etag | No | ETag of what this write left behind. Pass it as ifMatch on the next update to chain writes without re-reading. Absent when the API sent none; read the resource again before the next conditional write. | |
| flag | Yes | ||
| project | Yes | ||
| environment | Yes | ||
| rulesReplaced | Yes |