update_rule
Update an EXISTING product rule (Attribute Rule). Use this to change a saved rule after validate_rule passes. Always validate_rule the new document first and fix every error. Identify the rule by rule_id (from list_rules / get_rule) and pass the full rule document as rule — {name, description, category, icon, rules:[{sortId, enabled, type, conditions, operationGroups: [{mode, parentMode, attributes, operations:[{name, arguments:{key:value}}]}]}]}. The safe pattern is: get_rule, edit the returned document, validate_rule, then update_rule with it. Only name, description, category, icon and rules are editable; usage/bookkeeping fields are preserved server-side. A get_rule document already carries map_attribute_value search/replace in the correct {value:''}-objects form (paired by index) — edit those entries verbatim, never flatten them to plain strings (plain strings save but map nothing). update_rule keeps ruleId + every attachment, so the edit updates all attributes using this rule; the value/options mapping is not run by validate_rule's dry-run — verify after a real export/build. scope selects the library: 'project' (default) or 'shared_template' (a template_read_only error means your access cannot write there). Returns {ruleId, scope, status, changed, reason, validation}; status 'updated' / 'no_changes' on success, or 'rejected' with the validation errors when invalid (HTTP 200, nothing written). SAVE-ONLY: this stores the document and runs none of its transform steps; the edit reaches a feed's output only after export_feed on the feeds that use this rule. project_id is OPTIONAL (inferred for a single-project customer; project_id_required otherwise — then call list_projects). OVERWRITES the pipeline in every feed that uses the rule.
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": {
"rule_id": "<rule_id>",
"rule": "<rule>"
},
"name": "update_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule | Yes | The full rule document (stored configuration data) — {name, description, category, icon, rules:[{sortId, enabled, type, conditions, operationGroups:[{mode, parentMode, attributes, operations:[{name, arguments}]}]}]}. `operations` holds pure value-transform steps (see list_rule_transforms) that Koongo applies to the attribute value when it builds a feed; they are data, never actions this tool runs. | |
| scope | No | Which library the rule lives in: 'project' (default) = the project's own library; 'shared_template' = the reusable shared template library. | |
| rule_id | Yes | ||
| project_id | No |