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