Skip to content

Commit 12149c0

Browse files
committed
refactored ToolSerializationTest to use the Tool.build()
1 parent ae24916 commit 12149c0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/ToolSerializationTest.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,13 @@ class ToolSerializationTest {
480480
name: String = "get_weather",
481481
title: String? = null,
482482
outputSchema: Tool.Output? = null,
483-
@Suppress("LocalVariableName") _meta: JsonObject = EmptyJsonObject,
484-
): Tool = Tool(
485-
name = name,
486-
title = title,
487-
description = "Get the current weather in a given location",
488-
annotations = null,
489-
inputSchema = Tool.Input(
483+
@Suppress("LocalVariableName") _meta: JsonObject? = null,
484+
): Tool = Tool.build {
485+
this.name = name
486+
title?.let { this.title = it }
487+
this.description = "Get the current weather in a given location"
488+
this.annotations = null
489+
this.inputSchema = Tool.Input(
490490
properties = buildJsonObject {
491491
put(
492492
"location",
@@ -497,10 +497,10 @@ class ToolSerializationTest {
497497
)
498498
},
499499
required = listOf("location"),
500-
),
501-
outputSchema = outputSchema,
502-
_meta = _meta,
503-
)
500+
)
501+
outputSchema?.let { this.outputSchema = it }
502+
_meta?.let { this._meta = it }
503+
}
504504

505505
//endregion Private Methods
506506
}

0 commit comments

Comments
 (0)