Skip to content

Commit d1cabb4

Browse files
authored
feat: deprecate roots/sampling/logging types (#923)
1 parent f07ee4a commit d1cabb4

12 files changed

Lines changed: 130 additions & 6 deletions

crates/rmcp/src/handler/client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected.
2+
#![expect(deprecated)]
13
pub mod progress;
24
use std::sync::Arc;
35

crates/rmcp/src/handler/server.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected.
2+
#![expect(deprecated)]
13
use std::sync::Arc;
24

35
use crate::{

crates/rmcp/src/model.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Internal references to the SEP-2577-deprecated Roots/Sampling/Logging types
2+
// defined in this module are expected; the deprecation is advisory for downstream users.
3+
#![expect(deprecated)]
14
use std::{
25
borrow::Cow,
36
ops::{Deref, DerefMut},
@@ -1488,6 +1491,10 @@ pub type ToolListChangedNotification = NotificationNoParam<ToolListChangedNotifi
14881491
#[serde(rename_all = "lowercase")] //match spec
14891492
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
14901493
#[expect(clippy::exhaustive_enums, reason = "intentionally exhaustive")]
1494+
#[deprecated(
1495+
since = "2.0.0",
1496+
note = "Logging is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1497+
)]
14911498
pub enum LoggingLevel {
14921499
Debug,
14931500
Info,
@@ -1505,6 +1512,10 @@ const_string!(SetLevelRequestMethod = "logging/setLevel");
15051512
#[serde(rename_all = "camelCase")]
15061513
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15071514
#[non_exhaustive]
1515+
#[deprecated(
1516+
since = "2.0.0",
1517+
note = "Logging is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1518+
)]
15081519
pub struct SetLevelRequestParams {
15091520
/// Protocol-level metadata for this request (SEP-1319)
15101521
#[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
@@ -1534,6 +1545,10 @@ impl RequestParamsMeta for SetLevelRequestParams {
15341545
pub type SetLevelRequestParam = SetLevelRequestParams;
15351546

15361547
/// Request to set the logging level
1548+
#[deprecated(
1549+
since = "2.0.0",
1550+
note = "Logging is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1551+
)]
15371552
pub type SetLevelRequest = Request<SetLevelRequestMethod, SetLevelRequestParams>;
15381553

15391554
const_string!(LoggingMessageNotificationMethod = "notifications/message");
@@ -1542,6 +1557,10 @@ const_string!(LoggingMessageNotificationMethod = "notifications/message");
15421557
#[serde(rename_all = "camelCase")]
15431558
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
15441559
#[non_exhaustive]
1560+
#[deprecated(
1561+
since = "2.0.0",
1562+
note = "Logging is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1563+
)]
15451564
pub struct LoggingMessageNotificationParam {
15461565
/// The severity level of this log message
15471566
pub level: LoggingLevel,
@@ -1573,6 +1592,10 @@ impl LoggingMessageNotificationParam {
15731592
}
15741593

15751594
/// Notification containing a log message
1595+
#[deprecated(
1596+
since = "2.0.0",
1597+
note = "Logging is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1598+
)]
15761599
pub type LoggingMessageNotification =
15771600
Notification<LoggingMessageNotificationMethod, LoggingMessageNotificationParam>;
15781601

@@ -1581,6 +1604,10 @@ pub type LoggingMessageNotification =
15811604
// =============================================================================
15821605

15831606
const_string!(CreateMessageRequestMethod = "sampling/createMessage");
1607+
#[deprecated(
1608+
since = "2.0.0",
1609+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1610+
)]
15841611
pub type CreateMessageRequest = Request<CreateMessageRequestMethod, CreateMessageRequestParams>;
15851612

15861613
/// Represents the role of a participant in a conversation or message exchange.
@@ -1618,6 +1645,10 @@ pub enum ToolChoiceMode {
16181645
#[serde(rename_all = "camelCase")]
16191646
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
16201647
#[non_exhaustive]
1648+
#[deprecated(
1649+
since = "2.0.0",
1650+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1651+
)]
16211652
pub struct ToolChoice {
16221653
#[serde(skip_serializing_if = "Option::is_none")]
16231654
pub mode: Option<ToolChoiceMode>,
@@ -1750,6 +1781,10 @@ impl<T> From<Vec<T>> for SamplingContent<T> {
17501781
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
17511782
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17521783
#[non_exhaustive]
1784+
#[deprecated(
1785+
since = "2.0.0",
1786+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1787+
)]
17531788
pub struct SamplingMessage {
17541789
/// The role of the message sender (User or Assistant)
17551790
pub role: Role,
@@ -1764,6 +1799,10 @@ pub struct SamplingMessage {
17641799
#[serde(tag = "type", rename_all = "snake_case")]
17651800
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
17661801
#[non_exhaustive]
1802+
#[deprecated(
1803+
since = "2.0.0",
1804+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1805+
)]
17671806
pub enum SamplingMessageContentBlock {
17681807
Text(TextContent),
17691808
Image(ImageContent),
@@ -1912,6 +1951,10 @@ pub enum ContextInclusion {
19121951
#[serde(rename_all = "camelCase")]
19131952
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
19141953
#[non_exhaustive]
1954+
#[deprecated(
1955+
since = "2.0.0",
1956+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
1957+
)]
19151958
pub struct CreateMessageRequestParams {
19161959
/// Protocol-level metadata for this request (SEP-1319)
19171960
#[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
@@ -2125,6 +2168,10 @@ pub type CreateMessageRequestParam = CreateMessageRequestParams;
21252168
#[serde(rename_all = "camelCase")]
21262169
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21272170
#[non_exhaustive]
2171+
#[deprecated(
2172+
since = "2.0.0",
2173+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
2174+
)]
21282175
pub struct ModelPreferences {
21292176
/// Specific model names or families to prefer (e.g., "claude", "gpt")
21302177
#[serde(skip_serializing_if = "Option::is_none")]
@@ -2189,6 +2236,10 @@ impl Default for ModelPreferences {
21892236
#[derive(Default, Debug, Serialize, Deserialize, Clone, PartialEq)]
21902237
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
21912238
#[non_exhaustive]
2239+
#[deprecated(
2240+
since = "2.0.0",
2241+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
2242+
)]
21922243
pub struct ModelHint {
21932244
/// The suggested model name or family identifier
21942245
#[serde(skip_serializing_if = "Option::is_none")]
@@ -2522,6 +2573,10 @@ impl ArgumentInfo {
25222573
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
25232574
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25242575
#[non_exhaustive]
2576+
#[deprecated(
2577+
since = "2.0.0",
2578+
note = "Roots is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
2579+
)]
25252580
pub struct Root {
25262581
pub uri: String,
25272582
#[serde(skip_serializing_if = "Option::is_none")]
@@ -2554,12 +2609,20 @@ impl Root {
25542609
}
25552610

25562611
const_string!(ListRootsRequestMethod = "roots/list");
2612+
#[deprecated(
2613+
since = "2.0.0",
2614+
note = "Roots is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
2615+
)]
25572616
pub type ListRootsRequest = RequestNoParam<ListRootsRequestMethod>;
25582617

25592618
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
25602619
#[serde(rename_all = "camelCase")]
25612620
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
25622621
#[non_exhaustive]
2622+
#[deprecated(
2623+
since = "2.0.0",
2624+
note = "Roots is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
2625+
)]
25632626
pub struct ListRootsResult {
25642627
pub roots: Vec<Root>,
25652628
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
@@ -3167,6 +3230,10 @@ pub type CallToolRequest = Request<CallToolRequestMethod, CallToolRequestParams>
31673230
#[serde(rename_all = "camelCase")]
31683231
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
31693232
#[non_exhaustive]
3233+
#[deprecated(
3234+
since = "2.0.0",
3235+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
3236+
)]
31703237
pub struct CreateMessageResult {
31713238
/// The identifier of the model that generated the response
31723239
pub model: String,

crates/rmcp/src/model/content.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
//! [`SamplingMessageContentBlock`] extends the union with `tool_use` and `tool_result`
88
//! variants for sampling messages (SEP-1577).
99
10+
// ToolUseContent/ToolResultContent are SEP-2577-deprecated; internal references are expected.
11+
#![expect(deprecated)]
1012
use serde::{Deserialize, Serialize};
1113
use serde_json::json;
1214

@@ -178,6 +180,10 @@ impl EmbeddedResource {
178180
#[serde(rename_all = "camelCase")]
179181
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
180182
#[non_exhaustive]
183+
#[deprecated(
184+
since = "2.0.0",
185+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
186+
)]
181187
pub struct ToolUseContent {
182188
pub id: String,
183189
pub name: String,
@@ -191,6 +197,10 @@ pub struct ToolUseContent {
191197
#[serde(rename_all = "camelCase")]
192198
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
193199
#[non_exhaustive]
200+
#[deprecated(
201+
since = "2.0.0",
202+
note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
203+
)]
194204
pub struct ToolResultContent {
195205
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
196206
pub meta: Option<Meta>,

crates/rmcp/src/service/client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected.
2+
#![expect(deprecated)]
13
use std::borrow::Cow;
24

35
use thiserror::Error;

crates/rmcp/src/service/server.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected.
2+
#![expect(deprecated)]
13
use std::borrow::Cow;
24
#[cfg(feature = "elicitation")]
35
use std::collections::HashSet;

crates/rmcp/tests/common/handlers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Sampling/Roots/Logging are SEP-2577-deprecated; this test handler exercises them.
2+
#![expect(deprecated)]
13
use std::{
24
future::Future,
35
sync::{Arc, Mutex},

crates/rmcp/tests/test_message_protocol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//cargo test --test test_message_protocol --features "client server"
22
#![cfg(not(feature = "local"))]
3+
#![expect(deprecated)] // exercises SEP-2577-deprecated Sampling/Roots/Logging types
34

45
mod common;
56
use common::handlers::{TestClientHandler, TestServer};

crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@
494494
]
495495
}
496496
},
497+
"deprecated": true,
497498
"required": [
498499
"model",
499500
"role",
@@ -1152,6 +1153,7 @@
11521153
}
11531154
}
11541155
},
1156+
"deprecated": true,
11551157
"required": [
11561158
"roots"
11571159
]
@@ -1169,6 +1171,7 @@
11691171
"LoggingLevel": {
11701172
"description": "Logging levels supported by the MCP protocol",
11711173
"type": "string",
1174+
"deprecated": true,
11721175
"enum": [
11731176
"debug",
11741177
"info",
@@ -1894,6 +1897,7 @@
18941897
"type": "string"
18951898
}
18961899
},
1900+
"deprecated": true,
18971901
"required": [
18981902
"uri"
18991903
]
@@ -1953,6 +1957,7 @@
19531957
},
19541958
"SamplingMessageContentBlock": {
19551959
"description": "Content types for sampling messages (SEP-1577).",
1960+
"deprecated": true,
19561961
"oneOf": [
19571962
{
19581963
"type": "object",
@@ -2082,6 +2087,7 @@
20822087
]
20832088
}
20842089
},
2090+
"deprecated": true,
20852091
"required": [
20862092
"level"
20872093
]
@@ -2357,6 +2363,7 @@
23572363
"type": "string"
23582364
}
23592365
},
2366+
"deprecated": true,
23602367
"required": [
23612368
"toolUseId",
23622369
"content"
@@ -2384,6 +2391,7 @@
23842391
"type": "string"
23852392
}
23862393
},
2394+
"deprecated": true,
23872395
"required": [
23882396
"id",
23892397
"name",

crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@
494494
]
495495
}
496496
},
497+
"deprecated": true,
497498
"required": [
498499
"model",
499500
"role",
@@ -1152,6 +1153,7 @@
11521153
}
11531154
}
11541155
},
1156+
"deprecated": true,
11551157
"required": [
11561158
"roots"
11571159
]
@@ -1169,6 +1171,7 @@
11691171
"LoggingLevel": {
11701172
"description": "Logging levels supported by the MCP protocol",
11711173
"type": "string",
1174+
"deprecated": true,
11721175
"enum": [
11731176
"debug",
11741177
"info",
@@ -1894,6 +1897,7 @@
18941897
"type": "string"
18951898
}
18961899
},
1900+
"deprecated": true,
18971901
"required": [
18981902
"uri"
18991903
]
@@ -1953,6 +1957,7 @@
19531957
},
19541958
"SamplingMessageContentBlock": {
19551959
"description": "Content types for sampling messages (SEP-1577).",
1960+
"deprecated": true,
19561961
"oneOf": [
19571962
{
19581963
"type": "object",
@@ -2082,6 +2087,7 @@
20822087
]
20832088
}
20842089
},
2090+
"deprecated": true,
20852091
"required": [
20862092
"level"
20872093
]
@@ -2357,6 +2363,7 @@
23572363
"type": "string"
23582364
}
23592365
},
2366+
"deprecated": true,
23602367
"required": [
23612368
"toolUseId",
23622369
"content"
@@ -2384,6 +2391,7 @@
23842391
"type": "string"
23852392
}
23862393
},
2394+
"deprecated": true,
23872395
"required": [
23882396
"id",
23892397
"name",

0 commit comments

Comments
 (0)