feat: deprecate roots, sampling, and logging (SEP-2577) (#884)
SEP-2577 deprecates the Roots, Sampling, and Logging features. The deprecation is advisory: the features stay fully functional and there is no wire-level change. Mark the corresponding Rust APIs as deprecated so downstream users get compiler warnings and migration guidance. - Forward attributes through the service `method!` macros and deprecate `Peer::create_message`, `Peer::list_roots`, `Peer::set_level`, and `Peer::notify_logging_message`. - Forward per-field attributes through the capability `builder!` macro and deprecate the generated `enable_roots`, `enable_sampling`, and `enable_logging` builders, plus the hand-written `enable_roots_list_changed`, `enable_sampling_tools`, and `enable_sampling_context`. - Document the deprecation on the capability types and fields, and in the README feature sections. - Allow `deprecated` at the crate's own call sites so the build stays warning-clean, and refresh the message schema snapshots.
This commit is contained in:
parent
254f04a764
commit
82b04a31f5
7 changed files with 132 additions and 38 deletions
|
|
@ -112,10 +112,12 @@ impl TestServer {
|
|||
}
|
||||
|
||||
impl ServerHandler for TestServer {
|
||||
#[allow(deprecated)]
|
||||
fn get_info(&self) -> ServerInfo {
|
||||
ServerInfo::new(ServerCapabilities::builder().enable_logging().build())
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
fn set_level(
|
||||
&self,
|
||||
request: SetLevelRequestParams,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// cargo test --features "server client" --package rmcp test_logging
|
||||
#![cfg(not(feature = "local"))]
|
||||
#![allow(deprecated)]
|
||||
mod common;
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@
|
|||
},
|
||||
"ClientCapabilities": {
|
||||
"title": "Builder",
|
||||
"description": "```rust\n# use rmcp::model::ClientCapabilities;\nlet cap = ClientCapabilities::builder()\n .enable_experimental()\n .enable_roots()\n .enable_roots_list_changed()\n .build();\n```",
|
||||
"description": "```rust\n# use rmcp::model::ClientCapabilities;\nlet cap = ClientCapabilities::builder()\n .enable_experimental()\n .build();\n```",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"elicitation": {
|
||||
|
|
@ -308,6 +308,7 @@
|
|||
}
|
||||
},
|
||||
"roots": {
|
||||
"description": "Capability for filesystem roots (deprecated by SEP-2577).",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RootsCapabilities"
|
||||
|
|
@ -318,7 +319,7 @@
|
|||
]
|
||||
},
|
||||
"sampling": {
|
||||
"description": "Capability for LLM sampling requests (SEP-1577)",
|
||||
"description": "Capability for LLM sampling requests (SEP-1577, deprecated by SEP-2577).",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SamplingCapability"
|
||||
|
|
@ -1811,6 +1812,7 @@
|
|||
]
|
||||
},
|
||||
"RootsCapabilities": {
|
||||
"description": "Roots capability. Deprecated by SEP-2577; remains functional and will be\nremoved in a future release.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"listChanged": {
|
||||
|
|
@ -1827,7 +1829,7 @@
|
|||
"const": "notifications/roots/list_changed"
|
||||
},
|
||||
"SamplingCapability": {
|
||||
"description": "Sampling capability with optional sub-capabilities (SEP-1577).",
|
||||
"description": "Sampling capability with optional sub-capabilities (SEP-1577).\n\nDeprecated by SEP-2577; remains functional and will be removed in a future\nrelease.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
|
|
@ -1955,6 +1957,7 @@
|
|||
]
|
||||
},
|
||||
"SamplingTaskCapability": {
|
||||
"description": "Sampling task capability. Deprecated by SEP-2577; remains functional and\nwill be removed in a future release.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createMessage": {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@
|
|||
},
|
||||
"ClientCapabilities": {
|
||||
"title": "Builder",
|
||||
"description": "```rust\n# use rmcp::model::ClientCapabilities;\nlet cap = ClientCapabilities::builder()\n .enable_experimental()\n .enable_roots()\n .enable_roots_list_changed()\n .build();\n```",
|
||||
"description": "```rust\n# use rmcp::model::ClientCapabilities;\nlet cap = ClientCapabilities::builder()\n .enable_experimental()\n .build();\n```",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"elicitation": {
|
||||
|
|
@ -308,6 +308,7 @@
|
|||
}
|
||||
},
|
||||
"roots": {
|
||||
"description": "Capability for filesystem roots (deprecated by SEP-2577).",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/RootsCapabilities"
|
||||
|
|
@ -318,7 +319,7 @@
|
|||
]
|
||||
},
|
||||
"sampling": {
|
||||
"description": "Capability for LLM sampling requests (SEP-1577)",
|
||||
"description": "Capability for LLM sampling requests (SEP-1577, deprecated by SEP-2577).",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SamplingCapability"
|
||||
|
|
@ -1811,6 +1812,7 @@
|
|||
]
|
||||
},
|
||||
"RootsCapabilities": {
|
||||
"description": "Roots capability. Deprecated by SEP-2577; remains functional and will be\nremoved in a future release.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"listChanged": {
|
||||
|
|
@ -1827,7 +1829,7 @@
|
|||
"const": "notifications/roots/list_changed"
|
||||
},
|
||||
"SamplingCapability": {
|
||||
"description": "Sampling capability with optional sub-capabilities (SEP-1577).",
|
||||
"description": "Sampling capability with optional sub-capabilities (SEP-1577).\n\nDeprecated by SEP-2577; remains functional and will be removed in a future\nrelease.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
|
|
@ -1955,6 +1957,7 @@
|
|||
]
|
||||
},
|
||||
"SamplingTaskCapability": {
|
||||
"description": "Sampling task capability. Deprecated by SEP-2577; remains functional and\nwill be removed in a future release.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createMessage": {
|
||||
|
|
|
|||
|
|
@ -2724,6 +2724,7 @@
|
|||
]
|
||||
},
|
||||
"SamplingTaskCapability": {
|
||||
"description": "Sampling task capability. Deprecated by SEP-2577; remains functional and\nwill be removed in a future release.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createMessage": {
|
||||
|
|
@ -2737,7 +2738,7 @@
|
|||
},
|
||||
"ServerCapabilities": {
|
||||
"title": "Builder",
|
||||
"description": "```rust\n# use rmcp::model::ServerCapabilities;\nlet cap = ServerCapabilities::builder()\n .enable_logging()\n .enable_experimental()\n .enable_prompts()\n .enable_resources()\n .enable_tools()\n .enable_tool_list_changed()\n .build();\n```",
|
||||
"description": "```rust\n# use rmcp::model::ServerCapabilities;\nlet cap = ServerCapabilities::builder()\n .enable_experimental()\n .enable_prompts()\n .enable_resources()\n .enable_tools()\n .enable_tool_list_changed()\n .build();\n```",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"completions": {
|
||||
|
|
@ -2769,6 +2770,7 @@
|
|||
}
|
||||
},
|
||||
"logging": {
|
||||
"description": "Capability for server log message notifications (deprecated by SEP-2577).",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
|
|
|
|||
|
|
@ -2724,6 +2724,7 @@
|
|||
]
|
||||
},
|
||||
"SamplingTaskCapability": {
|
||||
"description": "Sampling task capability. Deprecated by SEP-2577; remains functional and\nwill be removed in a future release.\nSee <https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577>.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createMessage": {
|
||||
|
|
@ -2737,7 +2738,7 @@
|
|||
},
|
||||
"ServerCapabilities": {
|
||||
"title": "Builder",
|
||||
"description": "```rust\n# use rmcp::model::ServerCapabilities;\nlet cap = ServerCapabilities::builder()\n .enable_logging()\n .enable_experimental()\n .enable_prompts()\n .enable_resources()\n .enable_tools()\n .enable_tool_list_changed()\n .build();\n```",
|
||||
"description": "```rust\n# use rmcp::model::ServerCapabilities;\nlet cap = ServerCapabilities::builder()\n .enable_experimental()\n .enable_prompts()\n .enable_resources()\n .enable_tools()\n .enable_tool_list_changed()\n .build();\n```",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"completions": {
|
||||
|
|
@ -2769,6 +2770,7 @@
|
|||
}
|
||||
},
|
||||
"logging": {
|
||||
"description": "Capability for server log message notifications (deprecated by SEP-2577).",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
#![allow(deprecated)]
|
||||
mod common;
|
||||
|
||||
use anyhow::Result;
|
||||
|
|
|
|||
Loading…
Reference in a new issue