chore: add #[non_exhaustive] and mutation methods to improve compatibility (#715)

* chore: add #[non_exhaustive] to reduce backwards-incompatible changes going forward

* fix: remove ProtocolVersion import

* fix: add a few more with_ mutator methods

---------

Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
Jack Amadeo 2026-03-03 10:38:01 -05:00 • committed by GitHub
commit f63718d202
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,7 +17,7 @@ use std::time::Duration;
use futures::StreamExt;
use rmcp::{
RoleServer, ServerHandler,
model::{Implementation, ProtocolVersion, ServerCapabilities, ServerInfo, ToolsCapability},
model::{Implementation, ServerCapabilities, ServerInfo, ToolsCapability},
service::NotificationContext,
transport::streamable_http_server::{
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
@ -45,20 +45,14 @@ impl TestServer {
impl ServerHandler for TestServer {
fn get_info(&self) -> ServerInfo {
ServerInfo {
protocol_version: ProtocolVersion::LATEST,
capabilities: ServerCapabilities::builder()
ServerInfo::new(
ServerCapabilities::builder()
.enable_tools_with(ToolsCapability {
list_changed: Some(true),
})
.build(),
server_info: Implementation {
name: "test-server".to_string(),
version: "1.0.0".to_string(),
..Default::default()
},
instructions: None,
}
)
.with_server_info(Implementation::new("test-server", "1.0.0"))
}
async fn on_initialized(&self, context: NotificationContext<RoleServer>) {