docs: add missing KDoc comments for public functions, properties, and classes (#621)
This commit is contained in:
parent
c77ebe0c00
commit
bd4cf0c948
7 changed files with 21 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ public class ReadBuffer {
|
|||
|
||||
private val buffer: Buffer = Buffer()
|
||||
|
||||
/** Appends raw bytes to the internal buffer for subsequent message parsing. */
|
||||
public fun append(chunk: ByteArray) {
|
||||
buffer.write(chunk)
|
||||
}
|
||||
|
|
@ -86,6 +87,7 @@ public class ReadBuffer {
|
|||
}
|
||||
}
|
||||
|
||||
/** Clears all buffered data, discarding any partially received messages. */
|
||||
public fun clear() {
|
||||
buffer.clear()
|
||||
}
|
||||
|
|
@ -93,4 +95,5 @@ public class ReadBuffer {
|
|||
|
||||
internal fun deserializeMessage(line: String): JSONRPCMessage = McpJson.decodeFromString<JSONRPCMessage>(line)
|
||||
|
||||
/** Serializes a [JSONRPCMessage] to its JSON string representation with a trailing newline. */
|
||||
public fun serializeMessage(message: JSONRPCMessage): String = McpJson.encodeToString(message) + "\n"
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ public class ClientCapabilitiesBuilder @PublishedApi internal constructor() {
|
|||
*/
|
||||
public fun experimental(block: JsonObjectBuilder.() -> Unit): Unit = experimental(buildJsonObject(block))
|
||||
|
||||
/** Constructs the [ClientCapabilities] instance from the current builder state. */
|
||||
@PublishedApi
|
||||
internal fun build(): ClientCapabilities = ClientCapabilities(
|
||||
sampling = sampling,
|
||||
|
|
|
|||
|
|
@ -41,8 +41,10 @@ public sealed interface WithMeta {
|
|||
*/
|
||||
public typealias ProgressToken = RequestId
|
||||
|
||||
/** Creates a [ProgressToken] from a string value. */
|
||||
public fun ProgressToken(value: String): ProgressToken = RequestId(value)
|
||||
|
||||
/** Creates a [ProgressToken] from a numeric value. */
|
||||
public fun ProgressToken(value: Long): ProgressToken = RequestId(value)
|
||||
|
||||
// ============================================================================
|
||||
|
|
@ -127,6 +129,7 @@ public sealed interface Reference {
|
|||
public val type: ReferenceType
|
||||
}
|
||||
|
||||
/** Discriminator for [Reference] subtypes used in completion and other operations. */
|
||||
@Serializable
|
||||
public enum class ReferenceType(public val value: String) {
|
||||
@SerialName("ref/prompt")
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ public abstract class MediaContentBuilder {
|
|||
meta = buildJsonObject(block)
|
||||
}
|
||||
|
||||
/** Constructs the [MediaContent] instance from the current builder state. */
|
||||
@PublishedApi
|
||||
internal abstract fun build(): MediaContent
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import kotlinx.serialization.SerialName
|
|||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
/** Discriminator values for the polymorphic [ContentBlock] hierarchy. */
|
||||
@Serializable
|
||||
public enum class ContentTypes(public val value: String) {
|
||||
@SerialName("text")
|
||||
|
|
|
|||
|
|
@ -40,10 +40,12 @@ public fun RequestId(value: Long): RequestId = RequestId.NumberId(value)
|
|||
@Serializable(with = RequestIdPolymorphicSerializer::class)
|
||||
public sealed interface RequestId {
|
||||
|
||||
/** A string-based request identifier. */
|
||||
@JvmInline
|
||||
@Serializable
|
||||
public value class StringId(public val value: String) : RequestId
|
||||
|
||||
/** A numeric request identifier. */
|
||||
@JvmInline
|
||||
@Serializable
|
||||
public value class NumberId(public val value: Long) : RequestId
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ public data class CreateMessageResult(
|
|||
override val meta: JsonObject? = null,
|
||||
) : ClientResult
|
||||
|
||||
/** The reason why the LLM stopped generating tokens. */
|
||||
@JvmInline
|
||||
@Serializable
|
||||
public value class StopReason(public val value: String) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue