> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Targeting rule tools

> MCP tools for binding a segment and a trigger to an experiment.

Targeting rule tools control which visitors see an experiment and when it fires. Each experiment has one targeting rule that combines a segment and a trigger, and these tools change them.

## Tools

| Tool | Description | Example prompt |
| - | - | - |
| `targeting_rule_list` | List targeting rules on a site. | "List targeting rules for site `d1alzzxd7k`." |
| `targeting_rule_get` | Inspect a single targeting rule (segment, configuration, trigger, and the experiment it belongs to). | "Show targeting rule `118605`." |
| `targeting_rule_update` | Switch the segment or trigger that targets an experiment, and change its configuration. Only the fields you pass change. The tool rejects invalid configurations without a write. | "Target experiment `149640` to segment `200604`." |
| `targeting_rule_create` | Attach a targeting rule to an experiment that has none. Experiments created with `experiment_create` already have one, so use `targeting_rule_update` for those. | None |

## Parameters

Use the exact parameter names that `tools/list` returns.

| Tool | Required parameters | Optional parameters |
| - | - | - |
| `targeting_rule_list` | None | `siteCode`, `page`, `perPage` |
| `targeting_rule_get` | `targetingRuleId` | None |
| `targeting_rule_update` | `experimentId` | `targetingRuleId` (optional; when given, it must be the rule the experiment owns), `segmentId`, `segmentConfiguration` (`ALL_VISITORS` removes the segment), `triggerId`, `triggerConfiguration`, `targetingConfigurationParam`, `confirm` (required when the experiment isn't a draft) |
| `targeting_rule_create` | `segmentConfiguration`, `siteCode`, `experimentId` | `segmentId`, `triggerConfiguration`, `triggerId`, `targetingConfigurationParam` |

To bind a saved trigger to an experiment, call `targeting_rule_update` with `triggerConfiguration` set to `SAVED_TEMPLATE` and `targetingConfigurationParam` set to the trigger ID.

To bind a segment to an experiment, call `targeting_rule_update` with `segmentId` and `segmentConfiguration` set to `SAVED_TEMPLATE`. Pass `segmentId` and `segmentConfiguration` together.

**Accepted enum values:** `segmentConfiguration` is `ALL_VISITORS`, `AUTOPROMO_AUTODEFINED`, `GRAPHICAL_PAGES`, `HEAT_SLICE`, `PAGE`, `SAVED_TEMPLATE`, `SITE`, or `URL`, and `triggerConfiguration` takes the same values except `ALL_VISITORS`. The `targetingConfigurationParam` input is a saved trigger ID for `SAVED_TEMPLATE`, a segment ID for `HEAT_SLICE`, a full URL for `PAGE`, or a URL fragment for `URL`.
