Skip to main content
Glama
Featureflip

Featureflip

Official

Replace targeting rules

update_targeting
Destructive

Replace 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

NameRequiredDescriptionDefault
flagYesFlag key or id
rulesYesThe complete ordered rule list; rules left out are deleted
reasonNoWhy 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.
ifMatchNoetag 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.
projectYesProject key
environmentYesEnvironment key, e.g. production
freeze_overrideNoOwner/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

NameRequiredDescriptionDefault
etagNoETag 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.
flagYes
projectYes
environmentYes
rulesReplacedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.11.1
    • addedInput schema / properties / freeze_override
      Added value: +{
      +  "description": "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.",
      +  "type": "boolean"
      +}
  2. Changed1 schema field changedv0.7.0
    • addedInput schema / properties / reason
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
  3. Changed1 schema field changedv0.5.0
    • addedInput schema / properties / rules / items / properties / bucketBy
      Added value: +{
      +  "description": "Context attribute the rollout hashes on (default `user_id`; `userId` is accepted as an alias). Visitors whose context lacks it skip this rule, even at 100%. Changing it reshuffles who is in the rollout. Omit to keep the current value.",
      +  "maxLength": 255,
      +  "minLength": 1,
      +  "type": "string"
      +}
  4. Changed6 schema fields changedv0.3.0
    • addedInput schema / properties / environment / description
      Added value: +"Environment key, e.g. production"
    • addedInput schema / properties / flag / description
      Added value: +"Flag key or id"
    • addedInput schema / properties / ifMatch
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
    • addedInput schema / properties / project / description
      Added value: +"Project key"
    • addedInput schema / properties / rules / description
      Added value: +"The complete ordered rule list; rules left out are deleted"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "environment": {
      +      "type": "string"
      +    },
      +    "etag": {
      +      "description": "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.",
      +      "type": "string"
      +    },
      +    "flag": {
      +      "type": "string"
      +    },
      +    "project": {
      +      "type": "string"
      +    },
      +    "rulesReplaced": {
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "project",
      +    "flag",
      +    "environment",
      +    "rulesReplaced"
      +  ],
      +  "type": "object"
      +}
  5. First observedv0.1.6

TDQS

A4.7/5.0
Behavior5/5

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

Beyond destructiveHint=true, it discloses the traits that actually matter for a destructive write: omitted rules are deleted, rule order is meaningful, concurrent edits are refused with 412 rather than silently clobbered, and reason is mandatory in critical environments. That is exactly the context annotations cannot convey.

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

Conciseness5/5

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

Three sentences, no filler, and the destructive REPLACE semantics are front-loaded in capitals before the workflow advice. Each sentence carries a distinct actionable point.

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 destructive full-replace mutation with an output schema already covering return values, the definition covers what to read first, how to guard against races, and the audit/freeze requirements. Nothing an agent needs to call this safely is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds operational meaning to individual parameters: ifMatch must come from a prior get_targeting read and what to do on 412, reason's audit/critical-environment requirement, and the ordering constraint on rules. The nested rule fields are left entirely to the schema.

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

Purpose5/5

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

"REPLACE all targeting rules of a flag in one environment" gives a specific verb, resource and scope, and the parenthetical "full PUT — rules not included are removed" pins down semantics that distinguish it from the single-rule sibling manage_targeting_rule and from the read-only get_targeting.

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?

It names the required precursor workflow ("Get the current rules first with get_targeting") and the condition for using ifMatch, plus when freeze_override is legitimate (only after a change_frozen error with can_override true). What it lacks is an explicit statement of when to prefer manage_targeting_rule instead of a full replace.

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