struct

MCP::Protocol::StringSchema

Inherits JSON::Serializable < Struct < Value < Object

Schema definition for string properties.

Fields map to JSON Schema string with the MCP-required camelCase keys. Nil fields are omitted from serialization.

Constructors

new(title : Nil | String = nil, description : Nil | String = nil, min_length : Int32 | Nil = nil, max_length : Int32 | Nil = nil, format : Nil | String = nil, default : Nil | String = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

date

Convenience: pre-configures the date format (YYYY-MM-DD).

Source
date_time

Convenience: pre-configures the date-time format (ISO 8601).

Source
default

Default value for the property.

Source
description(val : String) : self

Set the optional description.

Source
description

Optional human-readable description.

Source
email

Convenience: pre-configures the email format.

Source
format(fmt : StringFormat) : self

Set the format from a StringFormat enum value.

Source
format

String format — one of "email", "uri", "date", "date-time".

Source
length(min : Int32, max : Int32) : self

Set both minimum and maximum length. Raises if min > max.

Source
max_length

Maximum string length (inclusive).

Source
min_length

Minimum string length (inclusive).

Source
title(val : String) : self

Set the optional title.

Source
title

Optional human-readable title.

Source
type
Source
uri

Convenience: pre-configures the uri format.

Source
with_default(val : String) : self

Set a default string value.

Source