pub struct McpSchema(/* private fields */);Expand description
Typed JSON Schema value used by generated MCP tool metadata.
This wrapper keeps schema-producing APIs distinct from arbitrary tool-call
JSON while still exposing the underlying serde_json::Value for tests,
protocol handoff, and last-mile schema extension.
Implementations§
Source§impl McpSchema
impl McpSchema
pub fn new(schema: Value) -> Self
pub fn any() -> Self
pub fn impossible() -> Self
pub fn typed(schema_type: McpSchemaType) -> Self
pub fn null() -> Self
pub fn boolean() -> Self
pub fn integer() -> Self
pub fn number() -> Self
pub fn string() -> Self
pub fn array(item_schema: McpSchema) -> Self
pub fn object() -> Self
pub fn any_of<I>(schemas: I) -> Selfwhere
I: IntoIterator<Item = McpSchema>,
pub fn one_of<I>(schemas: I) -> Selfwhere
I: IntoIterator<Item = McpSchema>,
pub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_extension(self, key: impl Into<String>, value: Value) -> Self
pub fn with_format(self, format: McpStringFormat) -> Self
pub fn with_minimum(self, minimum: impl Into<McpSchemaNumber>) -> Self
pub fn with_min_items(self, min_items: usize) -> Self
pub fn with_max_items(self, max_items: usize) -> Self
pub fn with_unique_items(self, unique_items: bool) -> Self
pub fn with_default(self, value: impl Into<Value>) -> Self
pub fn with_const(self, value: impl Into<Value>) -> Self
pub fn with_enum_values<I, V>(self, values: I) -> Self
pub fn with_items(self, item_schema: McpSchema) -> Self
pub fn with_prefix_items<I>(self, item_schemas: I) -> Selfwhere
I: IntoIterator<Item = McpSchema>,
pub fn with_properties(self, properties: McpSchemaProperties) -> Self
pub fn with_required<I, S>(self, required: I) -> Self
pub fn with_additional_properties( self, additional_properties: impl Into<McpAdditionalProperties>, ) -> Self
pub fn with_not(self, schema: McpSchema) -> Self
pub fn set_description(&mut self, description: impl Into<String>)
pub fn set_extension(&mut self, key: impl Into<String>, value: Value)
pub fn set_format(&mut self, format: McpStringFormat)
pub fn set_minimum(&mut self, minimum: impl Into<McpSchemaNumber>)
pub fn set_min_items(&mut self, min_items: usize)
pub fn set_max_items(&mut self, max_items: usize)
pub fn set_unique_items(&mut self, unique_items: bool)
pub fn set_default(&mut self, value: impl Into<Value>)
pub fn set_const(&mut self, value: impl Into<Value>)
pub fn set_enum_values<I, V>(&mut self, values: I)
pub fn set_items(&mut self, item_schema: McpSchema)
pub fn set_prefix_items<I>(&mut self, item_schemas: I)where
I: IntoIterator<Item = McpSchema>,
pub fn set_properties(&mut self, properties: McpSchemaProperties)
pub fn set_required<I, S>(&mut self, required: I)
pub fn set_additional_properties( &mut self, additional_properties: impl Into<McpAdditionalProperties>, )
pub fn set_any_of<I>(&mut self, schemas: I)where
I: IntoIterator<Item = McpSchema>,
pub fn set_one_of<I>(&mut self, schemas: I)where
I: IntoIterator<Item = McpSchema>,
pub fn set_not(&mut self, schema: McpSchema)
pub fn as_value(&self) -> &Value
pub fn as_object_mut(&mut self) -> Option<&mut Map<String, Value>>
pub fn into_value(self) -> Value
Trait Implementations§
impl Eq for McpSchema
Source§impl From<McpSchema> for McpAdditionalProperties
impl From<McpSchema> for McpAdditionalProperties
impl StructuralPartialEq for McpSchema
Auto Trait Implementations§
impl Freeze for McpSchema
impl RefUnwindSafe for McpSchema
impl Send for McpSchema
impl Sync for McpSchema
impl Unpin for McpSchema
impl UnsafeUnpin for McpSchema
impl UnwindSafe for McpSchema
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.