fix(client): serialize inputSchema as input_schema (#97)

This commit is contained in:
shiqicao 2025-05-05 23:39:12 -07:00 • committed by GitHub
commit 9341f1e42f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -3,6 +3,9 @@
package io.modelcontextprotocol.kotlin.sdk package io.modelcontextprotocol.kotlin.sdk
import io.modelcontextprotocol.kotlin.sdk.shared.McpJson import io.modelcontextprotocol.kotlin.sdk.shared.McpJson
import kotlinx.serialization.EncodeDefault
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonObject
@ -1043,6 +1046,7 @@ public data class Tool(
/** /**
* A JSON object defining the expected parameters for the tool. * A JSON object defining the expected parameters for the tool.
*/ */
@SerialName("input_schema")
val inputSchema: Input, val inputSchema: Input,
) { ) {
@Serializable @Serializable

View file

@ -16,7 +16,7 @@ class ToolSerializationTest {
{ {
"name": "get_weather", "name": "get_weather",
"description": "Get the current weather in a given location", "description": "Get the current weather in a given location",
"inputSchema": { "input_schema": {
"type": "object", "type": "object",
"properties": { "properties": {
"location": { "location": {