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
2 changes: 2 additions & 0 deletions crates/rmcp/src/handler/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected.
#![expect(deprecated)]
pub mod progress;
use std::sync::Arc;

Expand Down
2 changes: 2 additions & 0 deletions crates/rmcp/src/handler/server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected.
#![expect(deprecated)]
use std::sync::Arc;

use crate::{
Expand Down
67 changes: 67 additions & 0 deletions crates/rmcp/src/model.rs
Original file line number Diff line number Diff line change
@@ -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,
ops::{Deref, DerefMut},
Expand Down Expand Up @@ -1488,6 +1491,10 @@ pub type ToolListChangedNotification = NotificationNoParam<ToolListChangedNotifi
#[serde(rename_all = "lowercase")] //match spec
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[expect(clippy::exhaustive_enums, 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 enum LoggingLevel {
Debug,
Info,
Expand All @@ -1505,6 +1512,10 @@ const_string!(SetLevelRequestMethod = "logging/setLevel");
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[non_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 SetLevelRequestParams {
/// Protocol-level metadata for this request (SEP-1319)
#[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -1534,6 +1545,10 @@ impl RequestParamsMeta for SetLevelRequestParams {
pub type SetLevelRequestParam = SetLevelRequestParams;

/// Request to set the logging level
#[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 SetLevelRequest = Request<SetLevelRequestMethod, SetLevelRequestParams>;

const_string!(LoggingMessageNotificationMethod = "notifications/message");
Expand All @@ -1542,6 +1557,10 @@ const_string!(LoggingMessageNotificationMethod = "notifications/message");
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
#[non_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,
Expand Down Expand Up @@ -1573,6 +1592,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<LoggingMessageNotificationMethod, LoggingMessageNotificationParam>;

Expand All @@ -1581,6 +1604,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<CreateMessageRequestMethod, CreateMessageRequestParams>;

/// Represents the role of a participant in a conversation or message exchange.
Expand Down Expand Up @@ -1618,6 +1645,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<ToolChoiceMode>,
Expand Down Expand Up @@ -1750,6 +1781,10 @@ impl<T> From<Vec<T>> for SamplingContent<T> {
#[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,
Expand All @@ -1764,6 +1799,10 @@ pub struct SamplingMessage {
#[serde(tag = "type", rename_all = "snake_case")]
#[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 enum SamplingMessageContentBlock {
Text(TextContent),
Image(ImageContent),
Expand Down Expand Up @@ -1912,6 +1951,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")]
Expand Down Expand Up @@ -2125,6 +2168,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")]
Expand Down Expand Up @@ -2189,6 +2236,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")]
Expand Down Expand Up @@ -2522,6 +2573,10 @@ impl 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")]
Expand Down Expand Up @@ -2554,12 +2609,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<ListRootsRequestMethod>;

#[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<Root>,
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -3167,6 +3230,10 @@ pub type CallToolRequest = Request<CallToolRequestMethod, CallToolRequestParams>
#[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,
Expand Down
10 changes: 10 additions & 0 deletions crates/rmcp/src/model/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//! [`SamplingMessageContentBlock`] extends the union with `tool_use` and `tool_result`
//! variants for sampling messages (SEP-1577).
// ToolUseContent/ToolResultContent are SEP-2577-deprecated; internal references are expected.
#![expect(deprecated)]
use serde::{Deserialize, Serialize};
use serde_json::json;

Expand Down Expand Up @@ -178,6 +180,10 @@ impl EmbeddedResource {
#[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 {
pub id: String,
pub name: String,
Expand All @@ -191,6 +197,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 {
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
pub meta: Option<Meta>,
Expand Down
2 changes: 2 additions & 0 deletions crates/rmcp/src/service/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Sampling/Roots/Logging are SEP-2577-deprecated; internal references are expected.
#![expect(deprecated)]
use std::borrow::Cow;

use thiserror::Error;
Expand Down
2 changes: 2 additions & 0 deletions crates/rmcp/src/service/server.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 2 additions & 0 deletions crates/rmcp/tests/common/handlers.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down
1 change: 1 addition & 0 deletions crates/rmcp/tests/test_message_protocol.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
]
}
},
"deprecated": true,
"required": [
"model",
"role",
Expand Down Expand Up @@ -1152,6 +1153,7 @@
}
}
},
"deprecated": true,
"required": [
"roots"
]
Expand All @@ -1169,6 +1171,7 @@
"LoggingLevel": {
"description": "Logging levels supported by the MCP protocol",
"type": "string",
"deprecated": true,
"enum": [
"debug",
"info",
Expand Down Expand Up @@ -1894,6 +1897,7 @@
"type": "string"
}
},
"deprecated": true,
"required": [
"uri"
]
Expand Down Expand Up @@ -1953,6 +1957,7 @@
},
"SamplingMessageContentBlock": {
"description": "Content types for sampling messages (SEP-1577).",
"deprecated": true,
"oneOf": [
{
"type": "object",
Expand Down Expand Up @@ -2082,6 +2087,7 @@
]
}
},
"deprecated": true,
"required": [
"level"
]
Expand Down Expand Up @@ -2357,6 +2363,7 @@
"type": "string"
}
},
"deprecated": true,
"required": [
"toolUseId",
"content"
Expand Down Expand Up @@ -2384,6 +2391,7 @@
"type": "string"
}
},
"deprecated": true,
"required": [
"id",
"name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@
]
}
},
"deprecated": true,
"required": [
"model",
"role",
Expand Down Expand Up @@ -1152,6 +1153,7 @@
}
}
},
"deprecated": true,
"required": [
"roots"
]
Expand All @@ -1169,6 +1171,7 @@
"LoggingLevel": {
"description": "Logging levels supported by the MCP protocol",
"type": "string",
"deprecated": true,
"enum": [
"debug",
"info",
Expand Down Expand Up @@ -1894,6 +1897,7 @@
"type": "string"
}
},
"deprecated": true,
"required": [
"uri"
]
Expand Down Expand Up @@ -1953,6 +1957,7 @@
},
"SamplingMessageContentBlock": {
"description": "Content types for sampling messages (SEP-1577).",
"deprecated": true,
"oneOf": [
{
"type": "object",
Expand Down Expand Up @@ -2082,6 +2087,7 @@
]
}
},
"deprecated": true,
"required": [
"level"
]
Expand Down Expand Up @@ -2357,6 +2363,7 @@
"type": "string"
}
},
"deprecated": true,
"required": [
"toolUseId",
"content"
Expand Down Expand Up @@ -2384,6 +2391,7 @@
"type": "string"
}
},
"deprecated": true,
"required": [
"id",
"name",
Expand Down
Loading