# update_rate_rounding_rule

Update the name and/or the whole definition of a rate rounding rule. Pass the version from your last read as
expectedVersion. If it is stale the tool changes nothing and returns RATE_ROUNDING_RULE_VERSION_CONFLICT with the
current rule: show it to the user and wait for a new explicit instruction; it never retries with the new version. If the
outcome is uncertain (OUTCOME_UNKNOWN) it returns the current rule and does not retry. A change to the arithmetic
reprices, in the background, every product group that selects the rule; past bookings and quotes are not repriced. On
success only the id is returned and the rule's version changes: call get_rate_rounding_rule for the new version before
any further update or delete.

<!-- INPUT_BLOCK_START -->

## Input

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `ruleId` | `string` | Yes | The ID of the rounding rule to update |
| `expectedVersion` | `number` | Yes | The version of the rule you last read. A stale version fails with RATE_ROUNDING_RULE_VERSION_CONFLICT and changes nothing. |
| `name` | `string` | No | New name of the rounding rule, 1 to 150 characters |
| `definition` | `RateRoundingDefinition` | No | [RateRoundingDefinition](#rateroundingdefinition) |

### RateRoundingDefinition

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `stepUnits` | `number` | Yes | Whole major currency units between allowed prices, 1 to 100 (never a decimal) |
| `ending` | `RateRoundingEnding` | Yes | Where an allowed price sits relative to each multiple of the step. Either { kind: "FRACTION", hundredths: 0 to 99 } or { kind: "ONE_UNIT_UNDER" } with no hundredths, which needs stepUnits above 1 - [RateRoundingEnding](#rateroundingending) |
| `direction` | `Direction` | Yes | How the starting price is picked - [Direction](#direction) |

### RateRoundingEnding

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | `Kind` | Yes | FRACTION: allowed prices end in a fixed fraction of a major unit (needs hundredths). ONE_UNIT_UNDER: allowed prices sit one major unit below each multiple of the step (needs stepUnits above 1, takes no hundredths). - [Kind](#kind) |
| `hundredths` | `number` | No | Only for FRACTION, where it is required: hundredths of a major currency unit the price ends in, 0 to 99 (99 means .99). Leave it out for ONE_UNIT_UNDER. |

### Direction

| Value | Description |
| --- | --- |
| `DOWN` | Pick the allowed price at or below the starting price |
| `UP` | Pick the allowed price at or above the starting price |
| `NEAREST` | Pick the closest allowed price; a tie takes the higher one |

### Kind

| Value | Description |
| --- | --- |
| `FRACTION` | Allowed prices end in a fixed fraction of a major unit, for example .99 |
| `ONE_UNIT_UNDER` | Allowed prices sit one major unit below each multiple of the step |

<!-- INPUT_BLOCK_END -->

<!-- OUTPUT_BLOCK_START -->

## Output

| Field | Type | Description |
| --- | --- | --- |
| `content` | `ContentItem[]` | Array of content items returned by the tool - [ContentItem](#contentitem) |
| `isError` | `boolean` | Whether the tool execution resulted in an error |

### ContentItem

| Field | Type | Description |
| --- | --- | --- |
| `type` | `'text'` | Content type (currently only 'text' is supported) |
| `text` | `string` | The text content to display |

<!-- OUTPUT_BLOCK_END -->
