From 60a8985280d3e8d9687d187a9b4abb86cd4866b5 Mon Sep 17 00:00:00 2001 From: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com> Date: Sat, 31 Oct 2026 15:34:17 +0000 Subject: [PATCH] Fix speedPriority validation message (#1081) --- .../io/modelcontextprotocol/kotlin/sdk/types/sampling.kt | 2 +- .../io/modelcontextprotocol/kotlin/sdk/types/SamplingTest.kt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/sampling.kt b/kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/sampling.kt index 7cc26851f..f19f3dbb6 100644 --- a/kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/sampling.kt +++ b/kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/sampling.kt @@ -61,7 +61,7 @@ public data class ModelPreferences( } require(speedPriority == null || speedPriority in 0.0..1.0) { - "costPriority must be in 0.0 <= x <= 1.0 value range" + "speedPriority must be in 0.0 <= x <= 1.0 value range" } require(intelligencePriority == null || intelligencePriority in 0.0..1.0) { diff --git a/kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/SamplingTest.kt b/kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/SamplingTest.kt index 1f93d1237..7e3e02162 100644 --- a/kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/SamplingTest.kt +++ b/kotlin-sdk-core/src/commonTest/kotlin/io/modelcontextprotocol/kotlin/sdk/types/SamplingTest.kt @@ -22,8 +22,11 @@ class SamplingTest { @Test fun `should reject ModelPreferences with invalid priority`() { shouldThrow { ModelPreferences(costPriority = 1.5) } + .message shouldBe "costPriority must be in 0.0 <= x <= 1.0 value range" shouldThrow { ModelPreferences(speedPriority = -0.1) } + .message shouldBe "speedPriority must be in 0.0 <= x <= 1.0 value range" shouldThrow { ModelPreferences(intelligencePriority = 1.1) } + .message shouldBe "intelligencePriority must be in 0.0 <= x <= 1.0 value range" } @Test