add_segment_to_treatment
Add a segment to a feature flag's treatment using read-modify-write, avoiding accidental removal of existing targeting. Idempotent; does nothing if segment already present.
Instructions
Add a segment to a specific treatment of a feature flag via read-modify-write — safer than update_flag_definition's full replace, where a dropped field silently removes existing targeting. Idempotent: a no-op if the segment is already on the treatment. For workspaces where list_workspaces reports requiresTitleAndComments: true, pass title (and comment).
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": {
"workspace_id": "<workspace_id>",
"environment_id": "<environment_id>",
"flag_name": "<flag_name>",
"treatment": "<treatment>",
"segment": "<segment>"
},
"name": "add_segment_to_treatment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Change title. Required for workspaces with requiresTitleAndComments: true | |
| comment | No | Change comment. Required for workspaces with requiresTitleAndComments: true | |
| segment | Yes | The segment name to add | |
| flag_name | Yes | The feature flag name | |
| treatment | Yes | The treatment name to add the segment to (e.g. 'on') | |
| workspace_id | Yes | The workspace ID | |
| environment_id | Yes | The environment ID or name |