set_traffic_chaos
Configure Global Traffic Chaos for a mock API. This enables probabilistic or exact round-robin traffic distribution across multiple outcome channels: 'drop' (kills TCP connection — client gets connection reset), 'error' (returns HTTP error status), 'rule' (routes traffic to a specific conditional rule), and 'default' (serves the normal mock response). IMPORTANT: The 'rate' of all targets MUST add up to exactly 100. If they do not, this tool will return an error. For 'rule' type targets, obtain the ruleId by calling get_mock_detail first. Chaos is evaluated BEFORE any rule conditions — if a request is dropped, it never reaches rule logic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mockId | Yes | Database ID of the mock endpoint to configure chaos on | |
| enabled | Yes | Whether to enable or disable Global Traffic Chaos | |
| targets | Yes | List of traffic distribution channels. The sum of all 'rate' values MUST equal 100 exactly. | |
| errorBody | No | Optional JSON body to return for 'error' type targets. Defaults to empty if not specified. | |
| projectId | Yes | Database ID of the project | |
| errorStatus | No | HTTP status code to return for 'error' type targets. Defaults to 500 if not specified. | |
| distributionMode | Yes | 'probabilistic' = each request is randomly assigned a channel (like a dice roll). 'exact' = requests cycle through channels in a deterministic round-robin order, guaranteeing exact percentages over time. |