@@ -60,7 +60,7 @@ void testContentDeserializationWrongType() throws Exception {
6060 {"type":"WRONG","text":"XXX"}""" , McpSchema .TextContent .class ))
6161 .isInstanceOf (InvalidTypeIdException .class )
6262 .hasMessageContaining (
63- "Could not resolve type id 'WRONG' as a subtype of `io.modelcontextprotocol.spec.McpSchema$TextContent`: known type ids = [audio, image, resource, text]" );
63+ "Could not resolve type id 'WRONG' as a subtype of `io.modelcontextprotocol.spec.McpSchema$TextContent`: known type ids = [audio, image, resource, resource_link, text]" );
6464 }
6565
6666 @ Test
@@ -168,6 +168,36 @@ void testEmbeddedResourceWithBlobContentsDeserialization() throws Exception {
168168 .isEqualTo ("base64encodedblob" );
169169 }
170170
171+ @ Test
172+ void testResourceLink () throws Exception {
173+ McpSchema .ResourceLink resourceLink = new McpSchema .ResourceLink ("main.rs" ,
174+ "Rust Software Application Main File" , "file:///project/src/main.rs" , "Primary application entry point" ,
175+ "text/x-rust" , null , null );
176+ String value = mapper .writeValueAsString (resourceLink );
177+
178+ assertThatJson (value ).when (Option .IGNORING_ARRAY_ORDER )
179+ .when (Option .IGNORING_EXTRA_ARRAY_ITEMS )
180+ .isObject ()
181+ .isEqualTo (
182+ json ("""
183+ {"type":"resource_link","name":"main.rs","title":"Rust Software Application Main File","uri":"file:///project/src/main.rs","description":"Primary application entry point","mimeType":"text/x-rust"}""" ));
184+ }
185+
186+ @ Test
187+ void testResourceLinkDeserialization () throws Exception {
188+ McpSchema .ResourceLink resourceLink = mapper .readValue (
189+ """
190+ {"type":"resource_link","name":"main.rs","title":"Rust Software Application Main File","uri":"file:///project/src/main.rs","description":"Primary application entry point","mimeType":"text/x-rust"}""" ,
191+ McpSchema .ResourceLink .class );
192+ assertThat (resourceLink ).isNotNull ();
193+ assertThat (resourceLink .type ()).isEqualTo ("resource_link" );
194+ assertThat (resourceLink .name ()).isEqualTo ("main.rs" );
195+ assertThat (resourceLink .title ()).isEqualTo ("Rust Software Application Main File" );
196+ assertThat (resourceLink .uri ()).isEqualTo ("file:///project/src/main.rs" );
197+ assertThat (resourceLink .description ()).isEqualTo ("Primary application entry point" );
198+ assertThat (resourceLink .mimeType ()).isEqualTo ("text/x-rust" );
199+ }
200+
171201 // JSON-RPC Message Types Tests
172202
173203 @ Test
0 commit comments