diff --git a/crates/rmcp/src/handler/client.rs b/crates/rmcp/src/handler/client.rs index 926aafcb5..a7331f7dc 100644 --- a/crates/rmcp/src/handler/client.rs +++ b/crates/rmcp/src/handler/client.rs @@ -1,3 +1,5 @@ +// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected. +#![expect(deprecated)] pub mod progress; use std::sync::Arc; diff --git a/crates/rmcp/src/handler/server.rs b/crates/rmcp/src/handler/server.rs index aea596703..65ea477ec 100644 --- a/crates/rmcp/src/handler/server.rs +++ b/crates/rmcp/src/handler/server.rs @@ -1,3 +1,5 @@ +// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected. +#![expect(deprecated)] use std::sync::Arc; use crate::{ diff --git a/crates/rmcp/src/model.rs b/crates/rmcp/src/model.rs index 5fb7eb9ed..56ea97a50 100644 --- a/crates/rmcp/src/model.rs +++ b/crates/rmcp/src/model.rs @@ -1,3 +1,6 @@ +// Internal references to the SEP-2577-deprecated Roots/Sampling/Logging types +// defined in this module are expected; the deprecation is advisory for downstream users. +#![expect(deprecated)] use std::{borrow::Cow, sync::Arc}; mod annotated; mod capabilities; @@ -1453,6 +1456,10 @@ pub type ToolListChangedNotification = NotificationNoParam; const_string!(LoggingMessageNotificationMethod = "notifications/message"); @@ -1507,6 +1522,10 @@ const_string!(LoggingMessageNotificationMethod = "notifications/message"); #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")] +#[deprecated( + since = "2.0.0", + note = "Logging is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct LoggingMessageNotificationParam { /// The severity level of this log message pub level: LoggingLevel, @@ -1535,6 +1554,10 @@ impl LoggingMessageNotificationParam { } /// Notification containing a log message +#[deprecated( + since = "2.0.0", + note = "Logging is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub type LoggingMessageNotification = Notification; @@ -1543,6 +1566,10 @@ pub type LoggingMessageNotification = // ============================================================================= const_string!(CreateMessageRequestMethod = "sampling/createMessage"); +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub type CreateMessageRequest = Request; /// Represents the role of a participant in a conversation or message exchange. @@ -1580,6 +1607,10 @@ pub enum ToolChoiceMode { #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct ToolChoice { #[serde(skip_serializing_if = "Option::is_none")] pub mode: Option, @@ -1712,6 +1743,10 @@ impl From> for SamplingContent { #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct SamplingMessage { /// The role of the message sender (User or Assistant) pub role: Role, @@ -1726,6 +1761,10 @@ pub struct SamplingMessage { #[serde(tag = "type", rename_all = "snake_case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[expect(clippy::exhaustive_enums, reason = "intentionally exhaustive")] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub enum SamplingMessageContent { Text(RawTextContent), Image(RawImageContent), @@ -1878,6 +1917,10 @@ pub enum ContextInclusion { #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct CreateMessageRequestParams { /// Protocol-level metadata for this request (SEP-1319) #[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")] @@ -2091,6 +2134,10 @@ pub type CreateMessageRequestParam = CreateMessageRequestParams; #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct ModelPreferences { /// Specific model names or families to prefer (e.g., "claude", "gpt") #[serde(skip_serializing_if = "Option::is_none")] @@ -2155,6 +2202,10 @@ impl Default for ModelPreferences { #[derive(Default, Debug, Serialize, Deserialize, Clone, PartialEq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct ModelHint { /// The suggested model name or family identifier #[serde(skip_serializing_if = "Option::is_none")] @@ -2465,6 +2516,10 @@ pub struct ArgumentInfo { #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Roots is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct Root { pub uri: String, #[serde(skip_serializing_if = "Option::is_none")] @@ -2488,12 +2543,20 @@ impl Root { } const_string!(ListRootsRequestMethod = "roots/list"); +#[deprecated( + since = "2.0.0", + note = "Roots is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub type ListRootsRequest = RequestNoParam; #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)] #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Roots is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct ListRootsResult { pub roots: Vec, } @@ -3079,6 +3142,10 @@ pub type CallToolRequest = Request #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct CreateMessageResult { /// The identifier of the model that generated the response pub model: String, diff --git a/crates/rmcp/src/model/content.rs b/crates/rmcp/src/model/content.rs index 7054e2b0e..039f732e0 100644 --- a/crates/rmcp/src/model/content.rs +++ b/crates/rmcp/src/model/content.rs @@ -1,6 +1,8 @@ //! Content sent around agents, extensions, and LLMs //! The various content types can be display to humans but also understood by models //! They include optional annotations used to help inform agent usage +// ToolUseContent/ToolResultContent are SEP-2577-deprecated; internal references are expected. +#![expect(deprecated)] use serde::{Deserialize, Serialize}; use serde_json::json; @@ -79,6 +81,10 @@ pub type AudioContent = Annotated; #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct ToolUseContent { /// Unique identifier for this tool call pub id: String, @@ -96,6 +102,10 @@ pub struct ToolUseContent { #[serde(rename_all = "camelCase")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] #[non_exhaustive] +#[deprecated( + since = "2.0.0", + note = "Sampling is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577" +)] pub struct ToolResultContent { /// Optional metadata #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] diff --git a/crates/rmcp/src/service/client.rs b/crates/rmcp/src/service/client.rs index 7bb5d8238..05c2749fe 100644 --- a/crates/rmcp/src/service/client.rs +++ b/crates/rmcp/src/service/client.rs @@ -1,3 +1,5 @@ +// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected. +#![expect(deprecated)] use std::borrow::Cow; use thiserror::Error; diff --git a/crates/rmcp/src/service/server.rs b/crates/rmcp/src/service/server.rs index aa51e4704..402c97928 100644 --- a/crates/rmcp/src/service/server.rs +++ b/crates/rmcp/src/service/server.rs @@ -1,3 +1,5 @@ +// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected. +#![expect(deprecated)] use std::borrow::Cow; #[cfg(feature = "elicitation")] use std::collections::HashSet; diff --git a/crates/rmcp/tests/common/handlers.rs b/crates/rmcp/tests/common/handlers.rs index dd2d16ebb..81e3c5bbf 100644 --- a/crates/rmcp/tests/common/handlers.rs +++ b/crates/rmcp/tests/common/handlers.rs @@ -1,3 +1,5 @@ +// Sampling/Roots/Logging are SEP-2577-deprecated; this test handler exercises them. +#![expect(deprecated)] use std::{ future::Future, sync::{Arc, Mutex}, diff --git a/crates/rmcp/tests/test_message_protocol.rs b/crates/rmcp/tests/test_message_protocol.rs index 6fdb4285d..f42cfe0a1 100644 --- a/crates/rmcp/tests/test_message_protocol.rs +++ b/crates/rmcp/tests/test_message_protocol.rs @@ -1,5 +1,6 @@ //cargo test --test test_message_protocol --features "client server" #![cfg(not(feature = "local"))] +#![expect(deprecated)] // exercises SEP-2577-deprecated Sampling/Roots/Logging types mod common; use common::handlers::{TestClientHandler, TestServer}; diff --git a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json index 952aff8e4..fde8e3835 100644 --- a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json +++ b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json @@ -482,6 +482,7 @@ ] } }, + "deprecated": true, "required": [ "model", "role", @@ -1029,6 +1030,7 @@ } } }, + "deprecated": true, "required": [ "roots" ] @@ -1046,6 +1048,7 @@ "LoggingLevel": { "description": "Logging levels supported by the MCP protocol", "type": "string", + "deprecated": true, "enum": [ "debug", "info", @@ -1807,6 +1810,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "uri" ] @@ -1866,6 +1870,7 @@ }, "SamplingMessageContent": { "description": "Content types for sampling messages (SEP-1577).", + "deprecated": true, "oneOf": [ { "type": "object", @@ -1995,6 +2000,7 @@ ] } }, + "deprecated": true, "required": [ "level" ] @@ -2130,6 +2136,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "toolUseId" ] @@ -2160,6 +2167,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "id", "name", diff --git a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json index 952aff8e4..fde8e3835 100644 --- a/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json +++ b/crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json @@ -482,6 +482,7 @@ ] } }, + "deprecated": true, "required": [ "model", "role", @@ -1029,6 +1030,7 @@ } } }, + "deprecated": true, "required": [ "roots" ] @@ -1046,6 +1048,7 @@ "LoggingLevel": { "description": "Logging levels supported by the MCP protocol", "type": "string", + "deprecated": true, "enum": [ "debug", "info", @@ -1807,6 +1810,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "uri" ] @@ -1866,6 +1870,7 @@ }, "SamplingMessageContent": { "description": "Content types for sampling messages (SEP-1577).", + "deprecated": true, "oneOf": [ { "type": "object", @@ -1995,6 +2000,7 @@ ] } }, + "deprecated": true, "required": [ "level" ] @@ -2130,6 +2136,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "toolUseId" ] @@ -2160,6 +2167,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "id", "name", diff --git a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json index 5cb0cc8f1..5c424db23 100644 --- a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json +++ b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema.json @@ -760,6 +760,7 @@ } } }, + "deprecated": true, "required": [ "messages", "maxTokens" @@ -1550,6 +1551,7 @@ "LoggingLevel": { "description": "Logging levels supported by the MCP protocol", "type": "string", + "deprecated": true, "enum": [ "debug", "info", @@ -1589,6 +1591,7 @@ ] } }, + "deprecated": true, "required": [ "level", "data" @@ -1605,7 +1608,8 @@ "null" ] } - } + }, + "deprecated": true }, "ModelPreferences": { "description": "Preferences for model selection and behavior in sampling requests.\n\nThis allows servers to express their preferences for which model to use\nand how to balance different priorities when the client has multiple\nmodel options available.", @@ -1645,7 +1649,8 @@ ], "format": "float" } - } + }, + "deprecated": true }, "MultiSelectEnumSchema": { "description": "Multi-select enum options", @@ -2657,6 +2662,7 @@ ] } }, + "deprecated": true, "required": [ "role", "content" @@ -2664,6 +2670,7 @@ }, "SamplingMessageContent": { "description": "Content types for sampling messages (SEP-1577).", + "deprecated": true, "oneOf": [ { "type": "object", @@ -3427,7 +3434,8 @@ } ] } - } + }, + "deprecated": true }, "ToolChoiceMode": { "description": "Tool selection mode (SEP-1577).", @@ -3510,6 +3518,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "toolUseId" ] @@ -3540,6 +3549,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "id", "name", diff --git a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json index 5cb0cc8f1..5c424db23 100644 --- a/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json +++ b/crates/rmcp/tests/test_message_schema/server_json_rpc_message_schema_current.json @@ -760,6 +760,7 @@ } } }, + "deprecated": true, "required": [ "messages", "maxTokens" @@ -1550,6 +1551,7 @@ "LoggingLevel": { "description": "Logging levels supported by the MCP protocol", "type": "string", + "deprecated": true, "enum": [ "debug", "info", @@ -1589,6 +1591,7 @@ ] } }, + "deprecated": true, "required": [ "level", "data" @@ -1605,7 +1608,8 @@ "null" ] } - } + }, + "deprecated": true }, "ModelPreferences": { "description": "Preferences for model selection and behavior in sampling requests.\n\nThis allows servers to express their preferences for which model to use\nand how to balance different priorities when the client has multiple\nmodel options available.", @@ -1645,7 +1649,8 @@ ], "format": "float" } - } + }, + "deprecated": true }, "MultiSelectEnumSchema": { "description": "Multi-select enum options", @@ -2657,6 +2662,7 @@ ] } }, + "deprecated": true, "required": [ "role", "content" @@ -2664,6 +2670,7 @@ }, "SamplingMessageContent": { "description": "Content types for sampling messages (SEP-1577).", + "deprecated": true, "oneOf": [ { "type": "object", @@ -3427,7 +3434,8 @@ } ] } - } + }, + "deprecated": true }, "ToolChoiceMode": { "description": "Tool selection mode (SEP-1577).", @@ -3510,6 +3518,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "toolUseId" ] @@ -3540,6 +3549,7 @@ "type": "string" } }, + "deprecated": true, "required": [ "id", "name",