Skip to content

Commit bbfae7f

Browse files
committed
Fix minor issues in types
1 parent da0e322 commit bbfae7f

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/content.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public data class AudioContent(
9191
*
9292
* Hosts can use this to display file sizes and estimate context window usage.
9393
* @property mimeType The MIME type of this resource, if known.
94+
* @property icons Optional set of sized icons that clients can display in their user interface.
95+
* See [Icon] for supported formats and requirements.
9496
* @property description A description of what this resource represents.
9597
*
9698
* Clients can use this to improve the LLM’s understanding of available resources.
@@ -106,6 +108,7 @@ public data class ResourceLink(
106108
val title: String? = null,
107109
val size: Long? = null,
108110
val mimeType: String? = null,
111+
val icons: List<Icon>? = null,
109112
val description: String? = null,
110113
val annotations: Annotations? = null,
111114
override val meta: JsonObject? = null,

kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/jsonRpc.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ public data class RPCError(val code: Int, val message: String, val data: JsonEle
206206
public object ErrorCode {
207207
// SDK-specific error codes
208208
/** Connection was closed */
209-
public const val CONNECTION_CLOSED: Int = -1
209+
public const val CONNECTION_CLOSED: Int = -32000
210210

211211
/** Request timed out */
212-
public const val REQUEST_TIMEOUT: Int = -2
212+
public const val REQUEST_TIMEOUT: Int = -32001
213213

214214
// Standard JSON-RPC 2.0 error codes
215215
/** Invalid JSON was received */
@@ -226,11 +226,5 @@ public data class RPCError(val code: Int, val message: String, val data: JsonEle
226226

227227
/** Internal JSON-RPC error */
228228
public const val INTERNAL_ERROR: Int = -32603
229-
230-
/** Start of range for server-defined errors */
231-
public const val SERVER_ERROR_START: Int = -32000
232-
233-
/** End of range for server-defined errors */
234-
public const val SERVER_ERROR_END: Int = -32099
235229
}
236230
}

kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/ping.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import kotlinx.serialization.ExperimentalSerializationApi
55
import kotlinx.serialization.Serializable
66

77
@Serializable
8-
public data class PingRequest(override val params: BaseRequestParams? = null) : ServerRequest {
8+
public data class PingRequest(override val params: BaseRequestParams? = null) :
9+
ClientRequest,
10+
ServerRequest {
911
@OptIn(ExperimentalSerializationApi::class)
1012
@EncodeDefault
1113
override val method: Method = Method.Defined.Ping

kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk/types/sampling.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import kotlinx.serialization.ExperimentalSerializationApi
55
import kotlinx.serialization.SerialName
66
import kotlinx.serialization.Serializable
77
import kotlinx.serialization.json.JsonObject
8+
import kotlin.jvm.JvmInline
89

910
/**
1011
* Hints to use for model selection.
@@ -186,14 +187,12 @@ public data class CreateMessageResult(
186187
override val meta: JsonObject? = null,
187188
) : ClientResult
188189

190+
@JvmInline
189191
@Serializable
190-
public enum class StopReason {
191-
@SerialName("endTurn")
192-
EndTurn,
193-
194-
@SerialName("stopSequence")
195-
StopSequence,
196-
197-
@SerialName("maxTokens")
198-
MaxTokens,
192+
public value class StopReason(public val value: String) {
193+
public companion object {
194+
public val EndTurn: StopReason = StopReason("endTurn")
195+
public val StopSequence: StopReason = StopReason("stopSequence")
196+
public val MaxTokens: StopReason = StopReason("maxTokens")
197+
}
199198
}

0 commit comments

Comments
 (0)