{
  "$id": "https://betterstood.com/developers/v14/schemas/mcp/scenario_create_draft.input.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "definition": {
      "additionalProperties": false,
      "properties": {
        "analysis": {
          "additionalProperties": false,
          "properties": {
            "analysisQuestions": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "key": {
                    "pattern": "^[a-z][a-z0-9_]{1,63}$",
                    "type": "string"
                  },
                  "question": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "key",
                  "question"
                ],
                "type": "object"
              },
              "maxItems": 20,
              "type": "array"
            },
            "classificationAxes": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "key": {
                    "pattern": "^[a-z][a-z0-9_]{1,63}$",
                    "type": "string"
                  },
                  "label": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "values": {
                    "items": {
                      "maxLength": 256,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 12,
                    "minItems": 1,
                    "type": "array"
                  }
                },
                "required": [
                  "key",
                  "label",
                  "values"
                ],
                "type": "object"
              },
              "maxItems": 12,
              "type": "array"
            },
            "style": {
              "enum": [
                "lead_qualification",
                "qualitative_research",
                "diagnostic_intake",
                "hybrid"
              ],
              "type": "string"
            }
          },
          "type": "object"
        },
        "assistantName": {
          "description": "Optional assistant identity label. Betterstood keeps AI identity and actual recording/transcription wording server-owned.",
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        },
        "audience": {
          "maxLength": 8192,
          "minLength": 1,
          "type": "string"
        },
        "conversation": {
          "additionalProperties": false,
          "properties": {
            "instructions": {
              "default": [],
              "items": {
                "maxLength": 400,
                "minLength": 1,
                "type": "string"
              },
              "maxItems": 12,
              "type": "array"
            },
            "openingQuestion": {
              "maxLength": 8192,
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object"
        },
        "fields": {
          "items": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "collection": {
                    "additionalProperties": false,
                    "properties": {
                      "form": {
                        "additionalProperties": false,
                        "properties": {
                          "help_text": {
                            "maxLength": 240,
                            "type": "string"
                          },
                          "max_date": {
                            "format": "date",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                            "type": "string"
                          },
                          "max_number": {
                            "type": "number"
                          },
                          "min_date": {
                            "format": "date",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                            "type": "string"
                          },
                          "min_number": {
                            "type": "number"
                          },
                          "number_step": {
                            "exclusiveMinimum": 0,
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "mode": {
                        "enum": [
                          "conversation",
                          "form"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "mode"
                    ],
                    "type": "object"
                  },
                  "followupGuidance": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "goodAnswerExamples": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "key": {
                    "pattern": "^[a-z][a-z0-9_]{1,63}$",
                    "type": "string"
                  },
                  "label": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "options": {
                    "anyOf": [
                      {
                        "items": {
                          "maxLength": 256,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 100,
                        "type": "array"
                      },
                      {
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "label": {
                              "maxLength": 256,
                              "minLength": 1,
                              "type": "string"
                            },
                            "value": {
                              "maxLength": 256,
                              "minLength": 1,
                              "type": "string"
                            }
                          },
                          "required": [
                            "value",
                            "label"
                          ],
                          "type": "object"
                        },
                        "maxItems": 100,
                        "type": "array"
                      }
                    ]
                  },
                  "primaryQuestion": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "stopCondition": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "text",
                      "number",
                      "currency",
                      "boolean",
                      "select",
                      "date",
                      "email",
                      "phone"
                    ],
                    "type": "string"
                  },
                  "weakAnswerExamples": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  }
                },
                "required": [
                  "key",
                  "label",
                  "required",
                  "primaryQuestion",
                  "type"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "collection": {
                    "additionalProperties": false,
                    "properties": {
                      "form": {
                        "additionalProperties": false,
                        "properties": {
                          "help_text": {
                            "maxLength": 240,
                            "type": "string"
                          },
                          "max_date": {
                            "format": "date",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                            "type": "string"
                          },
                          "max_number": {
                            "type": "number"
                          },
                          "min_date": {
                            "format": "date",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
                            "type": "string"
                          },
                          "min_number": {
                            "type": "number"
                          },
                          "number_step": {
                            "exclusiveMinimum": 0,
                            "type": "number"
                          }
                        },
                        "type": "object"
                      },
                      "mode": {
                        "const": "form",
                        "type": "string"
                      }
                    },
                    "required": [
                      "mode"
                    ],
                    "type": "object"
                  },
                  "followupGuidance": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "goodAnswerExamples": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "key": {
                    "pattern": "^[a-z][a-z0-9_]{1,63}$",
                    "type": "string"
                  },
                  "label": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "options": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "label": {
                          "maxLength": 256,
                          "minLength": 1,
                          "type": "string"
                        },
                        "value": {
                          "maxLength": 256,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "value",
                        "label"
                      ],
                      "type": "object"
                    },
                    "maxItems": 20,
                    "minItems": 2,
                    "type": "array"
                  },
                  "primaryQuestion": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "stopCondition": {
                    "maxLength": 8192,
                    "minLength": 1,
                    "type": "string"
                  },
                  "type": {
                    "const": "multi_select",
                    "type": "string"
                  },
                  "weakAnswerExamples": {
                    "default": [],
                    "items": {
                      "maxLength": 8192,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  }
                },
                "required": [
                  "key",
                  "label",
                  "required",
                  "primaryQuestion",
                  "type",
                  "options",
                  "collection"
                ],
                "type": "object"
              }
            ]
          },
          "maxItems": 100,
          "minItems": 1,
          "type": "array"
        },
        "intake": {
          "additionalProperties": false,
          "properties": {
            "ctaLabel": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            },
            "headline": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            },
            "subheadline": {
              "maxLength": 8192,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "headline",
            "subheadline",
            "ctaLabel"
          ],
          "type": "object"
        },
        "liveFit": {
          "additionalProperties": false,
          "properties": {
            "gates": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "askEarly": {
                    "type": "boolean"
                  },
                  "closingMessage": {
                    "maxLength": 1000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "comparisonMode": {
                    "enum": [
                      "exact",
                      "semantic"
                    ],
                    "type": "string"
                  },
                  "confirmation": {
                    "enum": [
                      "only_if_ambiguous",
                      "required_on_mismatch"
                    ],
                    "type": "string"
                  },
                  "description": {
                    "maxLength": 500,
                    "type": "string"
                  },
                  "fieldKey": {
                    "pattern": "^[a-z][a-z0-9_]{1,63}$",
                    "type": "string"
                  },
                  "id": {
                    "pattern": "^[a-z][a-z0-9_]{1,63}$",
                    "type": "string"
                  },
                  "label": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxClarifications": {
                    "anyOf": [
                      {
                        "const": 0,
                        "type": "number"
                      },
                      {
                        "const": 1,
                        "type": "number"
                      }
                    ]
                  },
                  "operator": {
                    "enum": [
                      "equals",
                      "not_equals",
                      "in",
                      "not_in"
                    ],
                    "type": "string"
                  },
                  "preansweredMismatch": {
                    "enum": [
                      "block_before_start",
                      "confirm_live"
                    ],
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "values": {
                    "items": {
                      "anyOf": [
                        {
                          "maxLength": 1000,
                          "minLength": 1,
                          "type": "string"
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    },
                    "maxItems": 100,
                    "minItems": 1,
                    "type": "array"
                  }
                },
                "required": [
                  "id",
                  "label",
                  "fieldKey",
                  "operator",
                  "values",
                  "comparisonMode",
                  "askEarly",
                  "required",
                  "confirmation",
                  "maxClarifications",
                  "preansweredMismatch",
                  "closingMessage"
                ],
                "type": "object"
              },
              "maxItems": 10,
              "type": "array"
            },
            "schemaVersion": {
              "const": "live-fit.v1",
              "type": "string"
            }
          },
          "required": [
            "schemaVersion",
            "gates"
          ],
          "type": "object"
        },
        "outputs": {
          "additionalProperties": false,
          "properties": {
            "handoffLabel": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            },
            "requiredSections": {
              "items": {
                "maxLength": 256,
                "minLength": 1,
                "type": "string"
              },
              "maxItems": 50,
              "type": "array"
            },
            "summaryLabel": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "summaryLabel",
            "handoffLabel",
            "requiredSections"
          ],
          "type": "object"
        },
        "purpose": {
          "maxLength": 8192,
          "minLength": 1,
          "type": "string"
        },
        "scoring": {
          "additionalProperties": false,
          "properties": {
            "completenessEnabled": {
              "type": "boolean"
            },
            "completenessLabel": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            },
            "completenessThreshold": {
              "maximum": 5,
              "minimum": 1,
              "type": "integer"
            },
            "intentEnabled": {
              "type": "boolean"
            },
            "intentLabel": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            },
            "intentThreshold": {
              "maximum": 5,
              "minimum": 1,
              "type": "integer"
            },
            "qualificationMatch": {
              "enum": [
                "all",
                "any"
              ],
              "type": "string"
            }
          },
          "required": [
            "intentEnabled",
            "intentLabel",
            "completenessEnabled",
            "completenessLabel",
            "qualificationMatch",
            "intentThreshold",
            "completenessThreshold"
          ],
          "type": "object"
        },
        "tone": {
          "maxLength": 8192,
          "minLength": 1,
          "type": "string"
        }
      },
      "required": [
        "purpose"
      ],
      "type": "object"
    },
    "idempotencyKey": {
      "maxLength": 128,
      "minLength": 8,
      "type": "string"
    },
    "language": {
      "default": "en-US",
      "enum": [
        "it-IT",
        "en-US",
        "es-ES",
        "fr-FR",
        "de-DE",
        "hi-IN",
        "ru-RU",
        "pt-PT",
        "ja-JP",
        "nl-NL"
      ],
      "type": "string"
    },
    "name": {
      "maxLength": 256,
      "minLength": 1,
      "type": "string"
    },
    "templateId": {
      "enum": [
        "blank",
        "lead_qualification",
        "diagnostic_intake",
        "deep_qualitative_research",
        "guided_recommendation_placeholder"
      ],
      "type": "string"
    }
  },
  "required": [
    "idempotencyKey",
    "templateId",
    "name",
    "definition"
  ],
  "title": "scenario_create_draft input",
  "type": "object"
}
