Skip to content

Commit af2c937

Browse files
authored
Merge pull request modelcontextprotocol#250 from modelcontextprotocol/devcrocod/kotlin-quickstart-server-patch0
simplify creating input schema for kotlin server in quickstart
2 parents db8726c + f2de8ff commit af2c937

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

quickstart/server.mdx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,16 +1273,12 @@ server.addTool(
12731273
Get weather alerts for a US state. Input is Two-letter US state code (e.g. CA, NY)
12741274
""".trimIndent(),
12751275
inputSchema = Tool.Input(
1276-
properties = JsonObject(
1277-
mapOf(
1278-
"state" to JsonObject(
1279-
mapOf(
1280-
"type" to JsonPrimitive("string"),
1281-
"description" to JsonPrimitive("Two-letter US state code (e.g. CA, NY)")
1282-
)
1283-
),
1284-
)
1285-
),
1276+
properties = buildJsonObject {
1277+
putJsonObject("state") {
1278+
put("type", "string")
1279+
put("description", "Two-letter US state code (e.g. CA, NY)")
1280+
}
1281+
},
12861282
required = listOf("state")
12871283
)
12881284
) { request ->
@@ -1305,12 +1301,10 @@ server.addTool(
13051301
Get weather forecast for a specific latitude/longitude
13061302
""".trimIndent(),
13071303
inputSchema = Tool.Input(
1308-
properties = JsonObject(
1309-
mapOf(
1310-
"latitude" to JsonObject(mapOf("type" to JsonPrimitive("number"))),
1311-
"longitude" to JsonObject(mapOf("type" to JsonPrimitive("number"))),
1312-
)
1313-
),
1304+
properties = buildJsonObject {
1305+
putJsonObject("latitude") { put("type", "number") }
1306+
putJsonObject("longitude") { put("type", "number") }
1307+
},
13141308
required = listOf("latitude", "longitude")
13151309
)
13161310
) { request ->

0 commit comments

Comments
 (0)