fix!: remove server_info from DiscoverResult (#1065)
Fixes https://github.com/modelcontextprotocol/rust-sdk/issues/1064 Replaces https://github.com/modelcontextprotocol/rust-sdk/pull/1044 This removes the `server_info` field which is not part of the spec: https://modelcontextprotocol.io/specification/draft/schema#discoverresult.
This commit is contained in:
parent
e54c2220af
commit
9a41811a66
1 changed files with 373 additions and 155 deletions
|
|
@ -25,7 +25,7 @@ use crate::{
|
|||
NumberOrString, PaginatedRequestParams, ProgressNotification, ProgressNotificationParam,
|
||||
ProtocolVersion, ReadResourceRequest, ReadResourceRequestParams, ReadResourceResponse,
|
||||
ReadResourceResult, Reference, RequestId, RequestMetaObject, RootsListChangedNotification,
|
||||
ServerInfo, ServerJsonRpcMessage, ServerNotification, ServerRequest, ServerResult,
|
||||
ServerJsonRpcMessage, ServerNotification, ServerPeerInfo, ServerRequest, ServerResult,
|
||||
SetLevelRequest, SetLevelRequestParams, SubscribeRequest, SubscribeRequestParams,
|
||||
SubscriptionFilter, SubscriptionsListenRequest, SubscriptionsListenRequestParams,
|
||||
SubscriptionsListenResult, UnsubscribeRequest, UnsubscribeRequestParams, UpdateTaskParams,
|
||||
|
|
@ -213,7 +213,7 @@ impl ServiceRole for RoleClient {
|
|||
type PeerResp = ServerResult;
|
||||
type PeerNot = ServerNotification;
|
||||
type Info = ClientInfo;
|
||||
type PeerInfo = ServerInfo;
|
||||
type PeerInfo = ServerPeerInfo;
|
||||
type InitializeError = ClientInitializeError;
|
||||
const IS_CLIENT: bool = true;
|
||||
|
||||
|
|
@ -776,7 +776,7 @@ where
|
|||
let ServerResult::InitializeResult(initialize_result) = response else {
|
||||
return Err(ClientInitializeError::ExpectedInitResult(Some(response)));
|
||||
};
|
||||
peer.set_peer_info(initialize_result);
|
||||
peer.set_peer_info(initialize_result.into());
|
||||
|
||||
// send notification
|
||||
let notification = ClientJsonRpcMessage::notification(
|
||||
|
|
@ -846,13 +846,10 @@ where
|
|||
server_supported: result.supported_versions,
|
||||
});
|
||||
};
|
||||
peer.set_peer_info(ServerInfo {
|
||||
protocol_version: selected.clone(),
|
||||
capabilities: result.capabilities,
|
||||
server_info: result.server_info,
|
||||
instructions: result.instructions,
|
||||
meta: result.meta,
|
||||
});
|
||||
peer.set_peer_info(ServerPeerInfo::from_discover_result(
|
||||
selected.clone(),
|
||||
result,
|
||||
));
|
||||
peer.set_client_request_metadata(ClientRequestMetadata {
|
||||
protocol_version: selected,
|
||||
client_info: client_info.client_info.clone(),
|
||||
|
|
@ -2197,13 +2194,10 @@ mod tests {
|
|||
let peer = disconnected_peer();
|
||||
let meta = RequestMetaObject::default();
|
||||
let key = discover_cache_key();
|
||||
let expected = DiscoverResult::new(
|
||||
vec![ProtocolVersion::default()],
|
||||
Default::default(),
|
||||
crate::model::Implementation::from_build_env(),
|
||||
)
|
||||
.with_ttl_ms(5_000)
|
||||
.with_cache_scope(CacheScope::Public);
|
||||
let expected = DiscoverResult::new(vec![ProtocolVersion::default()], Default::default())
|
||||
.with_server_info(crate::model::Implementation::from_build_env())
|
||||
.with_ttl_ms(5_000)
|
||||
.with_cache_scope(CacheScope::Public);
|
||||
peer.cache_response(
|
||||
key,
|
||||
ServerResult::DiscoverResult(expected.clone()),
|
||||
|
|
|
|||
Loading…
Reference in a new issue