add_answer_logic
Add Answer Logic to one answer choice — the per-option (or per-matrix-row/-column) "if / then show" rule that decides whether THAT SPECIFIC choice appears to a respondent. This is NOT Jump/Skip Logic (that's add_jump_logic) and there is no "jump to a question" or "end the survey" action here — Answer Logic has exactly ONE possible outcome: show this one option (or, matrix rows/columns only, show OR hide it — see visibility below) when the condition(s) match. Never ask the end user for an action/destination; the only real decisions are (1) which condition(s) trigger it and (2) — matrix only — show or hide. Only available on multiplechoice, checkboxes, dropdown, colorpicker, multiplenumber, multipletext, ranking, and matrixrating questions. Identify the question with questionId/position, then the choice with optionId/optionPosition (for matrixrating, also pass target: "rows" or "columns" first). Omit entryIndex to create the choice's first "if" block; provide entryIndex: 0 (from get_answer_logic) to append the given condition(s) to it instead, combined via each condition's own conidition. Each choice can only ever have ONE entry — confirmed directly in the builder source (the "Add option/row/column condition" trigger only ever creates an entry for a choice that has none yet) — so omitting entryIndex when one already exists is refused outright (no force override; there's nothing legitimate to force through), pointing you at entryIndex: 0 instead. Use insertAfterConditionIndex to control WHERE a condition lands within an existing entry (omit to append at the end). Additive, not destructive — no confirmation needed beyond that one refusal, and NO randomization side effect either (confirmed absent, unlike question/submit Display Logic's first-entry button). The call is refused outright (no force override, nothing added) if a condition's source question comes after the OWNING question (the one this choice belongs to) in the survey — its answer wouldn't exist yet at that point. Reorder the questions (reorder_questions) or pick an earlier source question first, then retry. visibility ("show", the default, or "dontShow") is only meaningful for a matrixrating target and only applied when creating a NEW entry — a plain option always means "show when true," no toggle exists for it (use update_answer_logic to change visibility on an entry that already exists).
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": {
"surveyId": "<surveyId>",
"conditions": "<conditions>"
},
"name": "add_answer_logic"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | No | Required (and ONLY valid) for a matrixrating question — which axis optionId/optionPosition resolves against. | |
| teamId | No | Which team workspace to act in (ids come from get_account_info or list_surveys). Optional: if omitted, the server uses the team that owns the given surveyId, or your only team. Required for create_survey when you belong to several teams. | |
| optionId | No | The option's/row's/column's own id. Provide this OR optionPosition. | |
| position | No | 0-based index into the survey's questions array. Provide this OR questionId. | |
| surveyId | Yes | The Survey ID containing the question | |
| conditions | Yes | One or more conditions to add — to a new entry, or appended to entryIndex's existing entry. | |
| entryIndex | No | Existing Answer Logic entry index to append condition(s) to — always 0, since a choice can only ever have one entry. Omit only to create that first entry; if one already exists, omitting this is refused (a second entry would be silently inert, not an alternate rule). | |
| questionId | No | The question's id, as seen in get_survey_details's output | |
| visibility | No | Only for a matrixrating target, only applied when creating a NEW entry (entryIndex omitted). "show" (the default if omitted) means show this row/column when the conditions match; "dontShow" means hide it when they match. Refused for a plain-option target — the builder gives those no such field. | |
| optionPosition | No | 0-based index into the question's options (or matrixrating rows/columns, per `target`). Provide this OR optionId. | |
| insertAfterConditionIndex | No | Only used together with `entryIndex` (appending to an existing entry): where the new condition(s) land within that entry's condition list. -1 inserts at the very start, N inserts right after condition N. Omit to append at the end (the default). Ignored when creating the first entry. |