From f2de8ff3b503df51676a90893c545df9d9d2afdc Mon Sep 17 00:00:00 2001 From: devcrocod Date: Tue, 1 Apr 2025 19:31:37 +0200 Subject: [PATCH] simplify creating input schema for kotlin server in quickstart --- quickstart/server.mdx | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/quickstart/server.mdx b/quickstart/server.mdx index 920cc80..fd69f95 100644 --- a/quickstart/server.mdx +++ b/quickstart/server.mdx @@ -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 ->