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
|
|
@ -122,9 +122,11 @@ async fn discover_returns_server_metadata_without_session() {
|
|||
"resultType": "complete",
|
||||
"supportedVersions": ["2025-11-25"],
|
||||
"capabilities": { "tools": {} },
|
||||
"serverInfo": {
|
||||
"name": "discovery-server",
|
||||
"version": "1.0.0"
|
||||
"_meta": {
|
||||
"io.modelcontextprotocol/serverInfo": {
|
||||
"name": "discovery-server",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
},
|
||||
"instructions": "Use the tools carefully",
|
||||
"ttlMs": 0,
|
||||
|
|
@ -327,6 +329,38 @@ async fn discover_rejects_missing_client_capabilities() {
|
|||
cancellation_token.cancel();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn discover_accepts_missing_optional_client_info() {
|
||||
let (client, url, cancellation_token) = spawn_server(true).await;
|
||||
let body = json!({
|
||||
"jsonrpc": "2.0",
|
||||
"id": 5,
|
||||
"method": "server/discover",
|
||||
"params": {
|
||||
"_meta": {
|
||||
"io.modelcontextprotocol/protocolVersion": "2025-11-25",
|
||||
"io.modelcontextprotocol/clientCapabilities": {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let response = client
|
||||
.post(&url)
|
||||
.header("Content-Type", "application/json")
|
||||
.header("Accept", "application/json, text/event-stream")
|
||||
.header("MCP-Protocol-Version", "2025-11-25")
|
||||
.json(&body)
|
||||
.send()
|
||||
.await
|
||||
.expect("request should send");
|
||||
|
||||
assert_eq!(response.status(), 200);
|
||||
let body: serde_json::Value = response.json().await.expect("response should be JSON");
|
||||
assert!(body.get("result").is_some());
|
||||
|
||||
cancellation_token.cancel();
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn discover_error_uses_http_400_when_sse_is_configured() {
|
||||
let (client, url, cancellation_token) = spawn_server(false).await;
|
||||
|
|
|
|||
Loading…
Reference in a new issue