Skip to main content

ElicitationSchemaBuilder

Struct ElicitationSchemaBuilder 

Source
pub struct ElicitationSchemaBuilder {
    pub properties: BTreeMap<String, PrimitiveSchemaDefinition>,
    pub required: Vec<String>,
    pub title: Option<Cow<'static, str>>,
    pub description: Option<Cow<'static, str>>,
}
Expand description

Fluent builder for constructing elicitation schemas.

§Example

use rmcp::model::*;

let schema = ElicitationSchema::builder()
    .required_email("email")
    .required_integer("age", 0, 150)
    .optional_bool("newsletter", false)
    .description("User registration")
    .build();

Fields§

§properties: BTreeMap<String, PrimitiveSchemaDefinition>§required: Vec<String>§title: Option<Cow<'static, str>>§description: Option<Cow<'static, str>>

Implementations§

Source§

impl ElicitationSchemaBuilder

Source

pub fn new() -> ElicitationSchemaBuilder

Create a new builder

Source

pub fn property( self, name: impl Into<String>, schema: PrimitiveSchemaDefinition, ) -> ElicitationSchemaBuilder

Add a property to the schema

Source

pub fn required_property( self, name: impl Into<String>, schema: PrimitiveSchemaDefinition, ) -> ElicitationSchemaBuilder

Add a required property to the schema

Source

pub fn string_property( self, name: impl Into<String>, f: impl FnOnce(StringSchema) -> StringSchema, ) -> ElicitationSchemaBuilder

Add a string property with custom builder (required)

Source

pub fn required_string_property( self, name: impl Into<String>, f: impl FnOnce(StringSchema) -> StringSchema, ) -> ElicitationSchemaBuilder

Add a required string property with custom builder

Source

pub fn number_property( self, name: impl Into<String>, f: impl FnOnce(NumberSchema) -> NumberSchema, ) -> ElicitationSchemaBuilder

Add a number property with custom builder

Source

pub fn required_number_property( self, name: impl Into<String>, f: impl FnOnce(NumberSchema) -> NumberSchema, ) -> ElicitationSchemaBuilder

Add a required number property with custom builder

Source

pub fn integer_property( self, name: impl Into<String>, f: impl FnOnce(IntegerSchema) -> IntegerSchema, ) -> ElicitationSchemaBuilder

Add an integer property with custom builder

Source

pub fn required_integer_property( self, name: impl Into<String>, f: impl FnOnce(IntegerSchema) -> IntegerSchema, ) -> ElicitationSchemaBuilder

Add a required integer property with custom builder

Source

pub fn bool_property( self, name: impl Into<String>, f: impl FnOnce(BooleanSchema) -> BooleanSchema, ) -> ElicitationSchemaBuilder

Add a boolean property with custom builder

Source

pub fn required_bool_property( self, name: impl Into<String>, f: impl FnOnce(BooleanSchema) -> BooleanSchema, ) -> ElicitationSchemaBuilder

Add a required boolean property with custom builder

Source

pub fn required_string( self, name: impl Into<String>, ) -> ElicitationSchemaBuilder

Add a required string property

Source

pub fn optional_string( self, name: impl Into<String>, ) -> ElicitationSchemaBuilder

Add an optional string property

Source

pub fn required_email(self, name: impl Into<String>) -> ElicitationSchemaBuilder

Add a required email property

Source

pub fn optional_email(self, name: impl Into<String>) -> ElicitationSchemaBuilder

Add an optional email property

Source

pub fn required_string_with( self, name: impl Into<String>, f: impl FnOnce(StringSchema) -> StringSchema, ) -> ElicitationSchemaBuilder

Add a required string property with custom builder

Source

pub fn optional_string_with( self, name: impl Into<String>, f: impl FnOnce(StringSchema) -> StringSchema, ) -> ElicitationSchemaBuilder

Add an optional string property with custom builder

Source

pub fn required_number( self, name: impl Into<String>, min: f64, max: f64, ) -> ElicitationSchemaBuilder

Add a required number property with range

Source

pub fn optional_number( self, name: impl Into<String>, min: f64, max: f64, ) -> ElicitationSchemaBuilder

Add an optional number property with range

Source

pub fn required_number_with( self, name: impl Into<String>, f: impl FnOnce(NumberSchema) -> NumberSchema, ) -> ElicitationSchemaBuilder

Add a required number property with custom builder

Source

pub fn optional_number_with( self, name: impl Into<String>, f: impl FnOnce(NumberSchema) -> NumberSchema, ) -> ElicitationSchemaBuilder

Add an optional number property with custom builder

Source

pub fn required_integer( self, name: impl Into<String>, min: i64, max: i64, ) -> ElicitationSchemaBuilder

Add a required integer property with range

Source

pub fn optional_integer( self, name: impl Into<String>, min: i64, max: i64, ) -> ElicitationSchemaBuilder

Add an optional integer property with range

Source

pub fn required_integer_with( self, name: impl Into<String>, f: impl FnOnce(IntegerSchema) -> IntegerSchema, ) -> ElicitationSchemaBuilder

Add a required integer property with custom builder

Source

pub fn optional_integer_with( self, name: impl Into<String>, f: impl FnOnce(IntegerSchema) -> IntegerSchema, ) -> ElicitationSchemaBuilder

Add an optional integer property with custom builder

Source

pub fn required_bool(self, name: impl Into<String>) -> ElicitationSchemaBuilder

Add a required boolean property

Source

pub fn optional_bool( self, name: impl Into<String>, default: bool, ) -> ElicitationSchemaBuilder

Add an optional boolean property with default value

Source

pub fn required_bool_with( self, name: impl Into<String>, f: impl FnOnce(BooleanSchema) -> BooleanSchema, ) -> ElicitationSchemaBuilder

Add a required boolean property with custom builder

Source

pub fn optional_bool_with( self, name: impl Into<String>, f: impl FnOnce(BooleanSchema) -> BooleanSchema, ) -> ElicitationSchemaBuilder

Add an optional boolean property with custom builder

Source

pub fn required_enum_schema( self, name: impl Into<String>, enum_schema: EnumSchema, ) -> ElicitationSchemaBuilder

Add a required enum property using EnumSchema

Source

pub fn optional_enum_schema( self, name: impl Into<String>, enum_schema: EnumSchema, ) -> ElicitationSchemaBuilder

Add an optional enum property using EnumSchema

Source

pub fn mark_required(self, name: impl Into<String>) -> ElicitationSchemaBuilder

Mark an existing property as required

Source

pub fn title( self, title: impl Into<Cow<'static, str>>, ) -> ElicitationSchemaBuilder

Set the schema title

Source

pub fn description( self, description: impl Into<Cow<'static, str>>, ) -> ElicitationSchemaBuilder

Set the schema description

Source

pub fn build(self) -> Result<ElicitationSchema, &'static str>

Build the elicitation schema with validation

§Errors

Returns an error if:

  • Required fields reference non-existent properties
  • No properties are defined (empty schema)
Source

pub fn build_unchecked(self) -> ElicitationSchema

Build the elicitation schema without validation (panics on invalid schema)

§Panics

Panics if required fields reference non-existent properties

Trait Implementations§

Source§

impl Debug for ElicitationSchemaBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ElicitationSchemaBuilder

Source§

fn default() -> ElicitationSchemaBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more