File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import kotlin.test.assertEquals
66import kotlin.test.assertIs
77import kotlin.test.assertNotEquals
88import kotlin.test.assertTrue
9+ import kotlin.time.ExperimentalTime
10+ import kotlin.time.Instant
911
1012class TypesTest {
1113
@@ -236,6 +238,23 @@ class TypesTest {
236238 assertEquals(" text/x-rust" , textResource.mimeType)
237239 }
238240
241+ @OptIn(ExperimentalTime ::class )
242+ @Test
243+ fun `should serialize and deserialize annotations correctly` () {
244+ val annotations = Annotations (
245+ audience = listOf (Role .assistant),
246+ lastModified = Instant .parse(" 2025-06-18T00:00:00Z" ),
247+ priority = 0.5 ,
248+ )
249+
250+ val json = McpJson .encodeToString(annotations)
251+ val decoded = McpJson .decodeFromString<Annotations >(json)
252+
253+ assertEquals(listOf (Role .assistant), decoded.audience)
254+ assertEquals(Instant .parse(" 2025-06-18T00:00:00Z" ), decoded.lastModified)
255+ assertEquals(0.5 , decoded.priority)
256+ }
257+
239258 @Test
240259 fun `should serialize and deserialize prompt message correctly` () {
241260 val imageContent = ImageContent (
You can’t perform that action at this time.
0 commit comments