diff --git a/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt b/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt index 077b3f63..57a5f803 100644 --- a/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt +++ b/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types.kt @@ -18,11 +18,11 @@ import kotlin.concurrent.atomics.ExperimentalAtomicApi import kotlin.concurrent.atomics.incrementAndFetch import kotlin.jvm.JvmInline -public const val LATEST_PROTOCOL_VERSION: String = "2024-11-05" +public const val LATEST_PROTOCOL_VERSION: String = "2025-03-26" public val SUPPORTED_PROTOCOL_VERSIONS: Array = arrayOf( LATEST_PROTOCOL_VERSION, - "2024-10-07", + "2024-11-05", ) public const val JSONRPC_VERSION: String = "2.0" @@ -1250,7 +1250,7 @@ public class CallToolResult( ) : CallToolResultBase /** - * [CallToolResult] extended with backwards compatibility to protocol version 2024-10-07. + * [CallToolResult] extended with backwards compatibility to protocol version 2024-11-05. */ @Serializable public class CompatibilityCallToolResult( diff --git a/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/TypesTest.kt b/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/TypesTest.kt index c87d2bde..819db328 100644 --- a/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/TypesTest.kt +++ b/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/TypesTest.kt @@ -12,14 +12,14 @@ class TypesTest { @Test fun `should have correct latest protocol version`() { assertNotEquals("", LATEST_PROTOCOL_VERSION) - assertEquals("2024-11-05", LATEST_PROTOCOL_VERSION) + assertEquals("2025-03-26", LATEST_PROTOCOL_VERSION) } @Test fun `should have correct supported protocol versions`() { assertIs>(SUPPORTED_PROTOCOL_VERSIONS) assertTrue(SUPPORTED_PROTOCOL_VERSIONS.contains(LATEST_PROTOCOL_VERSION)) - assertTrue(SUPPORTED_PROTOCOL_VERSIONS.contains("2024-10-07")) + assertTrue(SUPPORTED_PROTOCOL_VERSIONS.contains("2024-11-05")) assertEquals(2, SUPPORTED_PROTOCOL_VERSIONS.size) } diff --git a/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/TypesTest.kt b/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/TypesTest.kt deleted file mode 100644 index 1714ded6..00000000 --- a/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/client/TypesTest.kt +++ /dev/null @@ -1,49 +0,0 @@ -package io.modelcontextprotocol.kotlin.sdk.client - -import io.modelcontextprotocol.kotlin.sdk.JSONRPCMessage -import io.modelcontextprotocol.kotlin.sdk.Request -import io.modelcontextprotocol.kotlin.sdk.shared.McpJson -import kotlin.test.Test - -class TypesTest { - - @Test - fun testRequestResult() { - val message = - "{\"result\":{\"protocolVersion\":\"2024-11-05\",\"capabilities\":{\"tools\":{\"listChanged\":true},\"resources\":{}},\"serverInfo\":{\"name\":\"jetbrains/proxy\",\"version\":\"0.1.0\"}},\"jsonrpc\":\"2.0\",\"id\":1}" - McpJson.decodeFromString(message) - } - - @Test - fun testRequestError() { - val message = - "{\"method\":\"initialize\", \"protocolVersion\":\"2024-11-05\",\"capabilities\":{\"experimental\":{},\"sampling\":{}},\"clientInfo\":{\"name\":\"test client\",\"version\":\"1.0\"},\"_meta\":{}}" - McpJson.decodeFromString(message) - } - - @Test - fun testJSONRPCMessage() { - val line = "{\"result\":{\"content\":[{\"type\":\"text\"}],\"isError\":false},\"jsonrpc\":\"2.0\",\"id\":4}" - McpJson.decodeFromString(line) - } - - @Test - fun testJSONRPCMessageWithStringId() { - val line = """ - { - "jsonrpc": "2.0", - "method": "initialize", - "id": "ebf9f64a-0", - "params": { - "protocolVersion": "2024-11-05", - "capabilities": {}, - "clientInfo": { - "name": "mcp-java-client", - "version": "0.2.0" - } - } - } - """.trimIndent() - McpJson.decodeFromString(line) - } -} \ No newline at end of file