pub enum JsonSchema {
String {
description: Option<String>,
pattern: Option<String>,
min_length: Option<u64>,
max_length: Option<u64>,
enum_values: Option<Vec<String>>,
},
Number {
description: Option<String>,
minimum: Option<f64>,
maximum: Option<f64>,
},
Integer {
description: Option<String>,
minimum: Option<i64>,
maximum: Option<i64>,
},
Boolean {
description: Option<String>,
},
Array {
description: Option<String>,
items: Option<Box<JsonSchema>>,
min_items: Option<u64>,
max_items: Option<u64>,
},
Object {
description: Option<String>,
properties: Option<HashMap<String, JsonSchema>>,
required: Option<Vec<String>>,
additional_properties: Option<bool>,
},
}
Expand description
Core MCP protocol types and error handling A JSON Schema definition
Variants§
String
String type
Fields
Number
Number type
Integer
Integer type
Boolean
Boolean type
Array
Array type
Fields
items: Option<Box<JsonSchema>>
Object
Object type
Implementations§
Source§impl JsonSchema
impl JsonSchema
Sourcepub fn string() -> JsonSchema
pub fn string() -> JsonSchema
Create a string schema
Sourcepub fn string_with_description(description: impl Into<String>) -> JsonSchema
pub fn string_with_description(description: impl Into<String>) -> JsonSchema
Create a string schema with description
Sourcepub fn string_enum(values: Vec<String>) -> JsonSchema
pub fn string_enum(values: Vec<String>) -> JsonSchema
Create a string enum schema
Sourcepub fn number() -> JsonSchema
pub fn number() -> JsonSchema
Create a number schema
Sourcepub fn number_with_description(description: impl Into<String>) -> JsonSchema
pub fn number_with_description(description: impl Into<String>) -> JsonSchema
Create a number schema with description
Sourcepub fn integer() -> JsonSchema
pub fn integer() -> JsonSchema
Create an integer schema
Sourcepub fn integer_with_description(description: impl Into<String>) -> JsonSchema
pub fn integer_with_description(description: impl Into<String>) -> JsonSchema
Create an integer schema with description
Sourcepub fn boolean() -> JsonSchema
pub fn boolean() -> JsonSchema
Create a boolean schema
Sourcepub fn boolean_with_description(description: impl Into<String>) -> JsonSchema
pub fn boolean_with_description(description: impl Into<String>) -> JsonSchema
Create a boolean schema with description
Sourcepub fn array(items: JsonSchema) -> JsonSchema
pub fn array(items: JsonSchema) -> JsonSchema
Create an array schema
Sourcepub fn array_with_description(
items: JsonSchema,
description: impl Into<String>,
) -> JsonSchema
pub fn array_with_description( items: JsonSchema, description: impl Into<String>, ) -> JsonSchema
Create an array schema with description
Sourcepub fn object() -> JsonSchema
pub fn object() -> JsonSchema
Create an object schema
Sourcepub fn object_with_properties(
properties: HashMap<String, JsonSchema>,
) -> JsonSchema
pub fn object_with_properties( properties: HashMap<String, JsonSchema>, ) -> JsonSchema
Create an object schema with properties
Sourcepub fn object_with_required(
properties: HashMap<String, JsonSchema>,
required: Vec<String>,
) -> JsonSchema
pub fn object_with_required( properties: HashMap<String, JsonSchema>, required: Vec<String>, ) -> JsonSchema
Create an object schema with properties and required fields
Sourcepub fn with_description(self, description: impl Into<String>) -> JsonSchema
pub fn with_description(self, description: impl Into<String>) -> JsonSchema
Add description to any schema
Sourcepub fn with_minimum(self, minimum: f64) -> JsonSchema
pub fn with_minimum(self, minimum: f64) -> JsonSchema
Add minimum constraint to number schema
Sourcepub fn with_maximum(self, maximum: f64) -> JsonSchema
pub fn with_maximum(self, maximum: f64) -> JsonSchema
Add maximum constraint to number schema
Sourcepub fn with_properties(
self,
properties: HashMap<String, JsonSchema>,
) -> JsonSchema
pub fn with_properties( self, properties: HashMap<String, JsonSchema>, ) -> JsonSchema
Add properties to object schema
Sourcepub fn with_required(self, required: Vec<String>) -> JsonSchema
pub fn with_required(self, required: Vec<String>) -> JsonSchema
Add required fields to object schema
Trait Implementations§
Source§impl Clone for JsonSchema
impl Clone for JsonSchema
Source§fn clone(&self) -> JsonSchema
fn clone(&self) -> JsonSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more