Set block logic
set-block-logic-toolReplace the conditional-logic rules attached to one draft block (scoring, jumps, calculations). Rules are evaluated after the respondent answers this block, in order; the first matching jump wins. Every rule is validated against the form — invalid rules are rejected with a message per rule explaining what to change, and nothing is saved. Call list-logic-options-tool first for the block ids, option ids, variables and comparison operators you may use.
Rule shape: {"always"?: true, "conditions": [Condition, ...], "actions": [Action, ...]}. A rule needs at least one condition unless "always" is true.
Condition shape: {"operator_1_type": "block"|"variable"|"calculation", "operator_1": <block id | variable name | "highest_variable"/"lowest_variable">, "operand": , "operator_2": <option id for radio/dropdown/checkbox blocks; number or text for other blocks and variables; variable name for calculation>, "operator_2_type": "option_id" for choice blocks, otherwise "" , "gate"?: "and"|"or" (2nd condition onwards), "matrix_row_id"? for matrix blocks}. Conditions may only reference this block or earlier blocks — later blocks are unanswered when the rule runs.
Action shapes: {"type": "jump", "block_id": }; arithmetic {"type": "add"|"subtract"|"multiply"|"divide", "operand_1": , "operand_1_type": "variable", "operand_2": <number | block id | variable name>, "operand_2_type": "value"|"block"|"variable"} — computes operand_1 = operand_1 operand_2, e.g. lion = lion + 1; set {"type": "set", "operand_1": <source: number | block id | variable name>, "operand_1_type": "value"|"block"|"variable", "operand_2": , "operand_2_type": "variable"} — copies operand_1 INTO operand_2 (the target is always operand_2 for set). Arithmetic needs a number variable created with update-variables-tool.
Outcome quiz pattern: on each question one rule per option adding 1 to that outcome's variable; on the LAST question also one jump rule per outcome with condition {"operator_1_type": "calculation", "operator_1": "highest_variable", "operand": "equal", "operator_2": "", "operator_2_type": ""} jumping to that outcome's ending block. Set default_transition on the last question to a fallback ending.
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": {
"form_slug": "<form_slug>",
"block_id": "<block_id>",
"logic": "<logic>"
},
"name": "set-block-logic-tool"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| logic | Yes | The complete list of rules for this block, replacing any existing rules. Pass [] to remove all rules. | |
| block_id | Yes | The id of the block the rules are attached to (the question whose answer triggers them). | |
| form_slug | Yes | The form's slug. | |
| default_transition | No | Optional fallback block id when no jump matches. Omit to preserve the existing fallback; pass an empty string to resume sequential order. |