OzMcp.Structs.StringSchema (OzMcp v0.9.0)

Copy Markdown View Source

Helper module used to build StringSchema structure: a text field of an elicitation form.

(MCP protocol: 2025-11-25)

Short example:

%StringSchema{}
  |> StringSchema.title("Email")
  |> StringSchema.format("email")
  |> StringSchema.build()

Result:

%{type: "string", title: "Email", format: "email"}

Specification: StringSchema

Fields

FieldSetterTypeRequired
titletitle/2stringno
descriptiondescription/2stringno
minLengthmin_length/2non-negative integerno
maxLengthmax_length/2non-negative integerno
formatformat/2"email", "uri", "date", "date-time"no
defaultdefault/2stringno

Summary

Types

t()

@type t() :: %OzMcp.Structs.StringSchema{
  default: String.t() | nil,
  description: String.t() | nil,
  format: term() | nil,
  maxLength: non_neg_integer() | nil,
  minLength: non_neg_integer() | nil,
  title: String.t() | nil
}

Functions

build(struct)

@spec build(t()) :: map()

default(struct, value)

@spec default(t(), String.t() | nil) :: t()

description(struct, value)

@spec description(t(), String.t() | nil) :: t()

format(struct, value)

@spec format(t(), term() | nil) :: t()

max_length(struct, value)

@spec max_length(t(), non_neg_integer() | nil) :: t()

min_length(struct, value)

@spec min_length(t(), non_neg_integer() | nil) :: t()

title(struct, value)

@spec title(t(), String.t() | nil) :: t()