Merge pull request #250 from modelcontextprotocol/devcrocod/kotlin-quickstart-server-patch0

simplify creating input schema for kotlin server in quickstart
This commit is contained in:
Pavel Gorgulov 2025-04-02 11:23:13 +02:00 • committed by GitHub
commit af2c937a7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1273,16 +1273,12 @@ server.addTool(
Get weather alerts for a US state. Input is Two-letter US state code (e.g. CA, NY)
""".trimIndent(),
inputSchema = Tool.Input(
properties = JsonObject(
mapOf(
"state" to JsonObject(
mapOf(
"type" to JsonPrimitive("string"),
"description" to JsonPrimitive("Two-letter US state code (e.g. CA, NY)")
)
),
)
),
properties = buildJsonObject {
putJsonObject("state") {
put("type", "string")
put("description", "Two-letter US state code (e.g. CA, NY)")
}
},
required = listOf("state")
)
) { request ->
@ -1305,12 +1301,10 @@ server.addTool(
Get weather forecast for a specific latitude/longitude
""".trimIndent(),
inputSchema = Tool.Input(
properties = JsonObject(
mapOf(
"latitude" to JsonObject(mapOf("type" to JsonPrimitive("number"))),
"longitude" to JsonObject(mapOf("type" to JsonPrimitive("number"))),
)
),
properties = buildJsonObject {
putJsonObject("latitude") { put("type", "number") }
putJsonObject("longitude") { put("type", "number") }
},
required = listOf("latitude", "longitude")
)
) { request ->