Skip to main content
Glama

Insert logic

editor_insertLogic

Insert one logic element containing exactly one conditional rule. Insert separate logic elements for additional rules. When a rule shows a question (show action), also set isHidden:true on that question so it is hidden by default — otherwise it stays visible in the editor baseline. See load_skill("logic-rules").

Input Schema

NameRequiredDescriptionDefault
ruleYesSingle conditional rule. Insert another logic block for each additional rule.
afterNoNodeId to insert after. Use $prev to chain. Omitting appends to end (usually wrong).
formIdYesForm ID to insert into

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / properties / rule / properties / actions / items / anyOf
      Removed value: -[
      -  {
      -    "properties": {
      -      "targets": {
      -        "items": {
      -          "anyOf": [
      -            {
      -              "properties": {
      -                "questionId": {
      -                  "description": "Any element with isHidden (question/paragraph/header/image/embed/list-item/table/row/column). Name kept for back-compat.",
      -                  "type": "string"
      -                },
      -                "scope": {
      -                  "const": "question",
      -                  "type": "string"
      -                }
      -              },
      -              "required": [
      -                "scope",
      -                "questionId"
      -              ],
      -              "type": "object"
      -            },
      -            {
      -              "properties": {
      -                "optionId": {
      -                  "type": "string"
      -                },
      -                "questionId": {
      -                  "type": "string"
      -                },
      -                "scope": {
      -                  "const": "option",
      -                  "type": "string"
      -                }
      -              },
      -              "required": [
      -                "scope",
      -                "questionId",
      -                "optionId"
      -              ],
      -              "type": "object"
      -            }
      -          ]
      -        },
      -        "type": "array"
      -      },
      -      "type": {
      -        "enum": [
      -          "show",
      -          "hide"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "targets"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "questionIds": {
      -        "items": {
      -          "type": "string"
      -        },
      -        "type": "array"
      -      },
      -      "type": {
      -        "enum": [
      -          "require",
      -          "optional"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "questionIds"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "pageId": {
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "setNextPage",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "pageId"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "message": {
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "preventNextPageNavigation",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "message": {
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "preventFormSubmit",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "fieldId": {
      -        "description": "Target field id to mutate. Pass the nodeId of a calculated-field element (hidden-field targets are rejected).",
      -        "type": "string"
      -      },
      -      "operation": {
      -        "properties": {
      -          "op": {
      -            "description": "Number fields: add/subtract/multiply/divide/set/reset (use set, never assign, for the first step of a numeric chain). Text fields: assign/concatenate/prepend/reset. Divide by literal 0 is rejected; empty, non-numeric, or zero fieldRef divisors are runtime no-ops.",
      -            "enum": [
      -              "add",
      -              "subtract",
      -              "multiply",
      -              "divide",
      -              "set",
      -              "reset",
      -              "assign",
      -              "concatenate",
      -              "prepend"
      -            ],
      -            "type": "string"
      -          },
      -          "value": {
      -            "anyOf": [
      -              {
      -                "properties": {
      -                  "kind": {
      -                    "const": "literal",
      -                    "type": "string"
      -                  },
      -                  "value": {}
      -                },
      -                "required": [
      -                  "kind",
      -                  "value"
      -                ],
      -                "type": "object"
      -              },
      -              {
      -                "properties": {
      -                  "fieldId": {
      -                    "type": "string"
      -                  },
      -                  "kind": {
      -                    "const": "fieldRef",
      -                    "type": "string"
      -                  }
      -                },
      -                "required": [
      -                  "kind",
      -                  "fieldId"
      -                ],
      -                "type": "object"
      -              }
      -            ],
      -            "description": "Omit for reset."
      -          }
      -        },
      -        "required": [
      -          "op"
      -        ],
      -        "type": "object"
      -      },
      -      "type": {
      -        "const": "calculateValue",
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "fieldId",
      -      "operation"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "properties": {
      -      "inputId": {
      -        "description": "Target payment input id — the nodeId of a payment-input element (not the question id).",
      -        "type": "string"
      -      },
      -      "op": {
      -        "description": "How to apply value (default 'set'): 'set' replaces the amount; 'increase'/'decrease' adjust the configured base price. Adjustments stack across rules in document order and clamp at 0.",
      -        "enum": [
      -          "set",
      -          "increase",
      -          "decrease"
      -        ],
      -        "type": "string"
      -      },
      -      "type": {
      -        "const": "setPaymentAmount",
      -        "type": "string"
      -      },
      -      "value": {
      -        "anyOf": [
      -          {
      -            "properties": {
      -              "kind": {
      -                "const": "literal",
      -                "type": "string"
      -              },
      -              "value": {}
      -            },
      -            "required": [
      -              "kind",
      -              "value"
      -            ],
      -            "type": "object"
      -          },
      -          {
      -            "properties": {
      -              "fieldId": {
      -                "type": "string"
      -              },
      -              "kind": {
      -                "const": "fieldRef",
      -                "type": "string"
      -              }
      -            },
      -            "required": [
      -              "kind",
      -              "fieldId"
      -            ],
      -            "type": "object"
      -          }
      -        ],
      -        "description": "Amount: a literal number, or a fieldRef to a field / calculated value. For increase/decrease this is the delta."
      -      }
      -    },
      -    "required": [
      -      "type",
      -      "inputId",
      -      "value"
      -    ],
      -    "type": "object"
      -  }
      -]
    • addedInput schema / properties / rule / properties / actions / items / oneOf
      Added value: +[
      +  {
      +    "properties": {
      +      "targets": {
      +        "items": {
      +          "oneOf": [
      +            {
      +              "properties": {
      +                "questionId": {
      +                  "description": "Any element with isHidden (question/paragraph/header/image/embed/list-item/table/row/column). Name kept for back-compat.",
      +                  "type": "string"
      +                },
      +                "scope": {
      +                  "const": "question",
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "scope",
      +                "questionId"
      +              ],
      +              "type": "object"
      +            },
      +            {
      +              "properties": {
      +                "optionId": {
      +                  "type": "string"
      +                },
      +                "questionId": {
      +                  "type": "string"
      +                },
      +                "scope": {
      +                  "const": "option",
      +                  "type": "string"
      +                }
      +              },
      +              "required": [
      +                "scope",
      +                "questionId",
      +                "optionId"
      +              ],
      +              "type": "object"
      +            }
      +          ]
      +        },
      +        "type": "array"
      +      },
      +      "type": {
      +        "enum": [
      +          "show",
      +          "hide"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "targets"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "questionIds": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "type": "array"
      +      },
      +      "type": {
      +        "enum": [
      +          "require",
      +          "optional"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "questionIds"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "pageId": {
      +        "type": "string"
      +      },
      +      "type": {
      +        "const": "setNextPage",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "pageId"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "message": {
      +        "type": "string"
      +      },
      +      "type": {
      +        "enum": [
      +          "preventNextPageNavigation",
      +          "preventFormSubmit"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "fieldId": {
      +        "description": "Target field id to mutate. Pass the nodeId of a calculated-field element (hidden-field targets are rejected).",
      +        "type": "string"
      +      },
      +      "operation": {
      +        "description": "Number fields: add/subtract/multiply/divide/set/reset (use set, never assign, for the first step of a numeric chain). Text fields: assign/concatenate/prepend/reset. Divide: literal 0 is rejected; a 0, empty or non-numeric fieldRef skips the step.",
      +        "oneOf": [
      +          {
      +            "properties": {
      +              "op": {
      +                "const": "reset",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "op"
      +            ],
      +            "type": "object"
      +          },
      +          {
      +            "properties": {
      +              "op": {
      +                "enum": [
      +                  "add",
      +                  "subtract",
      +                  "multiply",
      +                  "divide",
      +                  "set",
      +                  "assign",
      +                  "concatenate",
      +                  "prepend"
      +                ],
      +                "type": "string"
      +              },
      +              "value": {
      +                "oneOf": [
      +                  {
      +                    "properties": {
      +                      "kind": {
      +                        "const": "literal",
      +                        "type": "string"
      +                      },
      +                      "value": {
      +                        "type": [
      +                          "number",
      +                          "string",
      +                          "boolean"
      +                        ]
      +                      }
      +                    },
      +                    "required": [
      +                      "kind",
      +                      "value"
      +                    ],
      +                    "type": "object"
      +                  },
      +                  {
      +                    "properties": {
      +                      "fieldId": {
      +                        "type": "string"
      +                      },
      +                      "kind": {
      +                        "const": "fieldRef",
      +                        "type": "string"
      +                      }
      +                    },
      +                    "required": [
      +                      "kind",
      +                      "fieldId"
      +                    ],
      +                    "type": "object"
      +                  }
      +                ]
      +              }
      +            },
      +            "required": [
      +              "op",
      +              "value"
      +            ],
      +            "type": "object"
      +          }
      +        ]
      +      },
      +      "type": {
      +        "const": "calculateValue",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "fieldId",
      +      "operation"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "properties": {
      +      "inputId": {
      +        "description": "Target payment input id — the nodeId of a payment-input element (not the question id).",
      +        "type": "string"
      +      },
      +      "op": {
      +        "description": "How to apply value (default 'set'): 'set' replaces the amount; 'increase'/'decrease' adjust the configured base price. Adjustments stack across rules in document order and clamp at 0.",
      +        "enum": [
      +          "set",
      +          "increase",
      +          "decrease"
      +        ],
      +        "type": "string"
      +      },
      +      "type": {
      +        "const": "setPaymentAmount",
      +        "type": "string"
      +      },
      +      "value": {
      +        "description": "Amount: a literal number, or a fieldRef to a field / calculated value. For increase/decrease this is the delta.",
      +        "oneOf": [
      +          {
      +            "properties": {
      +              "kind": {
      +                "const": "literal",
      +                "type": "string"
      +              },
      +              "value": {
      +                "type": [
      +                  "number",
      +                  "string",
      +                  "boolean"
      +                ]
      +              }
      +            },
      +            "required": [
      +              "kind",
      +              "value"
      +            ],
      +            "type": "object"
      +          },
      +          {
      +            "properties": {
      +              "fieldId": {
      +                "type": "string"
      +              },
      +              "kind": {
      +                "const": "fieldRef",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "kind",
      +              "fieldId"
      +            ],
      +            "type": "object"
      +          }
      +        ]
      +      }
      +    },
      +    "required": [
      +      "type",
      +      "inputId",
      +      "value"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. First observed

TDQS

A3.7/5.0
Behavior4/5

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

Annotations cover the safety profile (non-read-only, non-destructive, closed world), and the description adds genuinely non-obvious behavioral context: that a show action requires isHidden:true on the target or it stays visible in the editor baseline. This is real value beyond the structured fields, though other mutation traits (permissions, ordering) are not covered.

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

Conciseness4/5

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

Three front-loaded sentences with no filler: purpose and cardinality first, then the actionable show/isHidden caveat, then a skill pointer. The final sentence could arguably be tighter, but every sentence carries information.

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

Completeness4/5

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

For a deeply nested, annotation-backed mutation tool with no output schema, the description covers the critical gotcha and the per-call granularity. It correctly defers deep rule semantics to the referenced skill rather than duplicating the schema.

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

Parameters3/5

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

Schema description coverage is 100% with rich nested descriptions, so the baseline is 3. The description reinforces the one-rule-per-call constraint on 'rule' but adds no syntax or format detail beyond what the schema already provides.

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

Purpose4/5

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

The description states a specific verb (Insert) and resource (one logic element containing exactly one conditional rule), and clarifies the cardinality constraint that additional rules need separate elements. It does not name the obvious sibling alternatives (editor_setLogic, editor_testLogic), so it misses full sibling differentiation.

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

Usage Guidelines3/5

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

It gives an implied usage pattern ('insert separate logic elements for additional rules') and a conditional caveat for show actions, but never states when to reach for this tool versus editor_setLogic or editor_testLogic. The load_skill pointer defers guidance elsewhere rather than providing it inline.

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.