File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package io.modelcontextprotocol.kotlin.sdk
33import io.kotest.assertions.json.shouldEqualJson
44import io.modelcontextprotocol.kotlin.sdk.shared.McpJson
55import kotlinx.serialization.encodeToString
6+ import kotlinx.serialization.json.Json
67import kotlinx.serialization.json.JsonPrimitive
78import kotlinx.serialization.json.buildJsonObject
89import kotlin.test.Test
@@ -54,4 +55,11 @@ class ToolSerializationTest {
5455 assertEquals(expected = getWeatherTool, actual = tool)
5556 }
5657
57- }
58+ @Test
59+ fun `should always serialize field with default value` () {
60+ val json = Json (from = McpJson ) {
61+ encodeDefaults = false
62+ }
63+ json.encodeToString(getWeatherTool) shouldEqualJson getWeatherToolJson
64+ }
65+ }
You can’t perform that action at this time.
0 commit comments