Helper module used to build a single-select enum field of an elicitation
form (UntitledSingleSelectEnumSchema or TitledSingleSelectEnumSchema).
(MCP protocol: 2025-11-25)
The options are strings, {value, title} tuples, or maps with const and
title (see OzMcp.Structs.EnumOptions). Without titles the schema uses
enum; with at least one title it uses oneOf.
Short example:
%EnumSchema{}
|> EnumSchema.options(["low", "high"])
|> EnumSchema.default("low")
|> EnumSchema.build()Result:
%{type: "string", enum: ["low", "high"], default: "low"}With titles:
%EnumSchema{}
|> EnumSchema.options([{"#ff0000", "Red"}, {"#00ff00", "Green"}])
|> EnumSchema.build()Result:
%{
type: "string",
oneOf: [%{const: "#ff0000", title: "Red"}, %{const: "#00ff00", title: "Green"}]
}Specification: EnumSchema
Fields
| Field | Setter | Type | Required |
|---|---|---|---|
title | title/2 | string | no |
description | description/2 | string | no |
options | options/2 | list(OzMcp.Structs.EnumOptions.option()) | no |
default | default/2 | string | no |
Summary
Types
@type t() :: %OzMcp.Structs.EnumSchema{ default: String.t() | nil, description: String.t() | nil, options: [OzMcp.Structs.EnumOptions.option()], title: String.t() | nil }