Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions crates/rmcp/src/model/elicitation_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ pub struct StringSchema {
/// String format - limited to: "email", "uri", "date", "date-time"
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<StringFormat>,

/// Default value
#[serde(skip_serializing_if = "Option::is_none")]
pub default: Option<String>,
}

impl Default for StringSchema {
Expand All @@ -124,6 +128,7 @@ impl Default for StringSchema {
min_length: None,
max_length: None,
format: None,
default: None,
}
}
}
Expand Down Expand Up @@ -213,6 +218,12 @@ impl StringSchema {
self.format = Some(format);
self
}

/// Set default value
pub fn with_default(mut self, default: impl Into<String>) -> Self {
self.default = Some(default.into());
self
}
}

// =============================================================================
Expand Down Expand Up @@ -246,6 +257,10 @@ pub struct NumberSchema {
/// Maximum value (inclusive)
#[serde(skip_serializing_if = "Option::is_none")]
pub maximum: Option<f64>,

/// Default value
#[serde(skip_serializing_if = "Option::is_none")]
pub default: Option<f64>,
}

impl Default for NumberSchema {
Expand All @@ -256,6 +271,7 @@ impl Default for NumberSchema {
description: None,
minimum: None,
maximum: None,
default: None,
}
}
}
Expand Down Expand Up @@ -307,6 +323,12 @@ impl NumberSchema {
self.description = Some(description.into());
self
}

/// Set default value
pub fn with_default(mut self, default: f64) -> Self {
self.default = Some(default);
self
}
}

// =============================================================================
Expand Down Expand Up @@ -340,6 +362,10 @@ pub struct IntegerSchema {
/// Maximum value (inclusive)
#[serde(skip_serializing_if = "Option::is_none")]
pub maximum: Option<i64>,

/// Default value
#[serde(skip_serializing_if = "Option::is_none")]
pub default: Option<i64>,
}

impl Default for IntegerSchema {
Expand All @@ -350,6 +376,7 @@ impl Default for IntegerSchema {
description: None,
minimum: None,
maximum: None,
default: None,
}
}
}
Expand Down Expand Up @@ -401,6 +428,12 @@ impl IntegerSchema {
self.description = Some(description.into());
self
}

/// Set default value
pub fn with_default(mut self, default: i64) -> Self {
self.default = Some(default);
self
}
}

// =============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,14 @@
"description": "Schema definition for integer properties.\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec.",
"type": "object",
"properties": {
"default": {
"description": "Default value",
"type": [
"integer",
"null"
],
"format": "int64"
},
"description": {
"description": "Human-readable description",
"type": [
Expand Down Expand Up @@ -1763,6 +1771,14 @@
"description": "Schema definition for number properties (floating-point).\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec.",
"type": "object",
"properties": {
"default": {
"description": "Default value",
"type": [
"number",
"null"
],
"format": "double"
},
"description": {
"description": "Human-readable description",
"type": [
Expand Down Expand Up @@ -2869,6 +2885,13 @@
"description": "Schema definition for string properties.\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec:\n- format limited to: \"email\", \"uri\", \"date\", \"date-time\"",
"type": "object",
"properties": {
"default": {
"description": "Default value",
"type": [
"string",
"null"
]
},
"description": {
"description": "Human-readable description",
"type": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,14 @@
"description": "Schema definition for integer properties.\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec.",
"type": "object",
"properties": {
"default": {
"description": "Default value",
"type": [
"integer",
"null"
],
"format": "int64"
},
"description": {
"description": "Human-readable description",
"type": [
Expand Down Expand Up @@ -1763,6 +1771,14 @@
"description": "Schema definition for number properties (floating-point).\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec.",
"type": "object",
"properties": {
"default": {
"description": "Default value",
"type": [
"number",
"null"
],
"format": "double"
},
"description": {
"description": "Human-readable description",
"type": [
Expand Down Expand Up @@ -2869,6 +2885,13 @@
"description": "Schema definition for string properties.\n\nCompliant with MCP 2025-06-18 specification for elicitation schemas.\nSupports only the fields allowed by the MCP spec:\n- format limited to: \"email\", \"uri\", \"date\", \"date-time\"",
"type": "object",
"properties": {
"default": {
"description": "Default value",
"type": [
"string",
"null"
]
},
"description": {
"description": "Human-readable description",
"type": [
Expand Down