feat!: align model types with MCP 2025-11-25 spec (#927)

* feat!: align model types with MCP 2025-11-25 spec

* fix: complete 2025-11-25 model spec conformance
This commit is contained in:
Dale Seo 2026-06-24 20:41:13 -04:00 • committed by GitHub
commit 77932141e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,10 +54,7 @@ fn test_complete_request_param_serialization() {
let request = CompleteRequestParams::new(
Reference::for_prompt("weather_prompt"),
ArgumentInfo {
name: "location".to_string(),
value: "San".to_string(),
},
ArgumentInfo::new("location", "San"),
)
.with_context(CompletionContext::with_arguments(args));
@ -144,11 +141,8 @@ fn test_reference_convenience_methods() {
#[test]
fn test_completion_serialization_format() {
// Test that completion follows MCP 2025-06-18 specification format
let completion = CompletionInfo {
values: vec!["value1".to_string(), "value2".to_string()],
total: Some(2),
has_more: Some(false),
};
let completion =
CompletionInfo::with_all_values(vec!["value1".to_string(), "value2".to_string()]).unwrap();
let json = serde_json::to_value(&completion).unwrap();
@ -162,18 +156,18 @@ fn test_completion_serialization_format() {
#[test]
fn test_resource_reference() {
// Test that ResourceReference works correctly
let resource_ref = ResourceReference {
uri: "test://uri".to_string(),
};
// ResourceTemplateReference가 `ref/resource` 와이어 태그로 직렬화/역직렬화되는지 확인
let reference = Reference::for_resource("test://uri");
// Test that ResourceReference works correctly
let another_ref = ResourceReference {
uri: "test://uri".to_string(),
};
let json = serde_json::to_value(&reference).unwrap();
assert_eq!(json["type"], "ref/resource");
assert_eq!(json["uri"], "test://uri");
// They should be equivalent
assert_eq!(resource_ref.uri, another_ref.uri);
let back: Reference = serde_json::from_value(json).unwrap();
match back {
Reference::Resource(r) => assert_eq!(r.uri, "test://uri"),
other => panic!("expected Reference::Resource, got {other:?}"),
}
}
#[test]
@ -197,10 +191,7 @@ fn test_mcp_schema_compliance() {
// Test that our types serialize correctly according to MCP specification
let request = CompleteRequestParams::new(
Reference::for_resource("file://{path}"),
ArgumentInfo {
name: "path".to_string(),
value: "src/".to_string(),
},
ArgumentInfo::new("path", "src/"),
);
let json_str = serde_json::to_string(&request).unwrap();