Documentation
¶
Overview ¶
Package elicitform turns MCP elicitation schemas into form fields and validates the user's answers, independent of how a TUI renders them.
Index ¶
Constants ¶
View Source
const ( TypeBoolean = "boolean" TypeEnum = "enum" TypeMultiSelect = "multiselect" TypeNumber = "number" TypeInteger = "integer" TypeString = "string" )
Field types produced by ParseSchema. Any other type is entered as text.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Answer ¶
Answer is the raw state of one field; only the member matching the field's type is read.
func DefaultAnswer ¶
DefaultAnswer seeds a field's answer from its schema default.
type Field ¶
type Field struct {
Name, Title, Type, Description string
Required bool
EnumValues []string
// EnumTitles and EnumDescriptions parallel EnumValues for titled choices
// (oneOf / items.anyOf); EnumTitles are shown instead of the values.
EnumTitles, EnumDescriptions []string
Default any
MinLength, MaxLength int
MinItems, MaxItems int
Format, Pattern string
Minimum, Maximum float64
HasMinimum, HasMaximum bool
}
Field represents a form field extracted from a JSON schema.
func ParseSchema ¶
ParseSchema extracts fields from a JSON schema. Supports both object schemas with properties and primitive type schemas.
func (Field) OptionLabels ¶
OptionLabels returns what a form shows for each choice.
Click to show internal directories.
Click to hide internal directories.