pub enum EnumSchema {
Single(SingleSelectEnumSchema),
Multi(MultiSelectEnumSchema),
Legacy(LegacyEnumSchema),
}Expand description
Compliant with MCP 2025-06-18 specification for elicitation schemas. Enums must have string type for values and can optionally include human-readable names.
§Example
use rmcp::model::*;
let enum_schema = EnumSchema::builder(vec!["US".to_string(), "UK".to_string()])
.multiselect()
.min_items(1u64).expect("Min items should be correct value")
.max_items(4u64).expect("Max items should be correct value")
.description("Country code")
.build();Variants§
Implementations§
Source§impl EnumSchema
impl EnumSchema
Sourcepub fn builder(values: Vec<String>) -> EnumSchemaBuilder<SingleSelect>
pub fn builder(values: Vec<String>) -> EnumSchemaBuilder<SingleSelect>
Creates a new EnumSchemaBuilder with the given enum values.
This convenience method allows you to construct an enum schema by specifying the possible string values for the enum. Use the returned builder to further configure the schema before building it.
§Arguments
values- A vector of strings representing the allowed enum values.
§Example
use rmcp::model::*;
let enum_schema = EnumSchema::builder(vec!["A".to_string(), "B".to_string()]).
with_default("A").
expect("Default value should be valid").
enum_titles(vec!["Option A".to_string(), "Option B".to_string()]).
expect("Number of titles should match number of values").
build();Trait Implementations§
Source§impl Clone for EnumSchema
impl Clone for EnumSchema
Source§fn clone(&self) -> EnumSchema
fn clone(&self) -> EnumSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnumSchema
impl Debug for EnumSchema
Source§impl<'de> Deserialize<'de> for EnumSchema
impl<'de> Deserialize<'de> for EnumSchema
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EnumSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EnumSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for EnumSchema
impl JsonSchema for EnumSchema
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for EnumSchema
impl PartialEq for EnumSchema
Source§impl Serialize for EnumSchema
impl Serialize for EnumSchema
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for EnumSchema
Auto Trait Implementations§
impl Freeze for EnumSchema
impl RefUnwindSafe for EnumSchema
impl Send for EnumSchema
impl Sync for EnumSchema
impl Unpin for EnumSchema
impl UnsafeUnpin for EnumSchema
impl UnwindSafe for EnumSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more