Skip to main content
Glama

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

NameRequiredDescriptionDefault
targetNoRequired (and ONLY valid) for a matrixrating question — which axis optionId/optionPosition resolves against.
teamIdNoWhich 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.
optionIdNoThe option's/row's/column's own id. Provide this OR optionPosition.
positionNo0-based index into the survey's questions array. Provide this OR questionId.
surveyIdYesThe Survey ID containing the question
conditionsYesOne or more conditions to add — to a new entry, or appended to entryIndex's existing entry.
entryIndexNoExisting 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).
questionIdNoThe question's id, as seen in get_survey_details's output
visibilityNoOnly 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.
optionPositionNo0-based index into the question's options (or matrixrating rows/columns, per `target`). Provide this OR optionId.
insertAfterConditionIndexNoOnly 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only say readOnlyHint=false, destructiveHint=false, idempotentHint=false and openWorldHint=true; the description adds far more: no randomization side effect, no confirmation prompt, exact refusal conditions (source question ordered after the owning question; omitting entryIndex when an entry already exists; visibility on a plain option), and the explicit absence of a force override. It also explains why the second-entry case cannot be forced ('silently inert'), which is causal context an agent cannot infer from annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The scope-and-contrast framing is correctly front-loaded, but the body is one long stream of em-dash-clause parentheticals and self-justifying asides ('confirmed directly in the builder source', 'confirmed absent, unlike question/submit Display Logic's first-entry button') that read as reasoning traces rather than instructions. Several sentences re-explain what the schema fields already say, bloating an already dense 11-parameter definition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-parameter mutation tool with no output schema, the description covers everything needed to call it correctly: question-type eligibility, matrix axis targeting, entry-creation vs append semantics, insertion position, refusal modes and their recovery paths, and the absence of side effects. Return-value description is unnecessary here since no output schema exists.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3; the description still earns more by explaining cross-parameter interactions the schema documents only per-field — target gating for matrixrating axes, insertAfterConditionIndex only mattering with entryIndex, the condition-combining role of each condition's own `conidition`, and visibility applying only on new-entry creation. It does restate some entryIndex/visibility wording that the schema already carries, which keeps it below 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names the exact verb and the exact per-choice resource, then immediately contrasts it with the sibling it is most likely confused with (add_jump_logic) and with the destination actions it does NOT perform. An agent can distinguish this from add_jump_logic, update_answer_logic, and add_display_logic without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It states when to use this tool, when not to (jump/skip logic, destination actions), which question types are eligible (multiplechoice, checkboxes, dropdown, colorpicker, multiplenumber, multipletext, ranking, matrixrating), and which alternatives to reach for in the failure cases (reorder_questions, an earlier source question, entryIndex: 0, update_answer_logic for changing visibility).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources