Skip to content

Commit 6cc40e1

Browse files
committed
Add missing annotations
1 parent cf98075 commit 6cc40e1

File tree

1 file changed

+64
-1
lines changed
  • kotlin-sdk-core/src/commonMain/kotlin/io/modelcontextprotocol/kotlin/sdk

1 file changed

+64
-1
lines changed

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

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import kotlin.concurrent.atomics.AtomicLong
1717
import kotlin.concurrent.atomics.ExperimentalAtomicApi
1818
import kotlin.concurrent.atomics.incrementAndFetch
1919
import kotlin.jvm.JvmInline
20+
import kotlin.time.ExperimentalTime
21+
import kotlin.time.Instant
2022

2123
public const val LATEST_PROTOCOL_VERSION: String = "2025-03-26"
2224

@@ -718,6 +720,10 @@ public data class Resource(
718720
* The optional size of this resource in bytes, if known.
719721
*/
720722
val size: Long? = null,
723+
/**
724+
* Optional annotations for the client.
725+
*/
726+
val annotations: Annotations? = null,
721727
)
722728

723729
/**
@@ -750,6 +756,10 @@ public data class ResourceTemplate(
750756
* The optional human-readable name of this resource for display purposes.
751757
*/
752758
val title: String? = null,
759+
/**
760+
* Optional annotations for the client.
761+
*/
762+
val annotations: Annotations? = null,
753763
)
754764

755765
/**
@@ -983,6 +993,11 @@ public data class TextContent(
983993
* The text content of the message.
984994
*/
985995
val text: String? = null,
996+
997+
/**
998+
* Optional annotations for the client.
999+
*/
1000+
val annotations: Annotations? = null,
9861001
) : PromptMessageContentMultimodal {
9871002
override val type: String = TYPE
9881003

@@ -1005,6 +1020,11 @@ public data class ImageContent(
10051020
* The MIME type of the image. Different providers may support different image types.
10061021
*/
10071022
val mimeType: String,
1023+
1024+
/**
1025+
* Optional annotations for the client.
1026+
*/
1027+
val annotations: Annotations? = null,
10081028
) : PromptMessageContentMultimodal {
10091029
override val type: String = TYPE
10101030

@@ -1027,6 +1047,11 @@ public data class AudioContent(
10271047
* The MIME type of the audio. Different providers may support different audio types.
10281048
*/
10291049
val mimeType: String,
1050+
1051+
/**
1052+
* Optional annotations for the client.
1053+
*/
1054+
val annotations: Annotations? = null,
10301055
) : PromptMessageContentMultimodal {
10311056
override val type: String = TYPE
10321057

@@ -1045,7 +1070,17 @@ public data class UnknownContent(override val type: String) : PromptMessageConte
10451070
* The contents of a resource, embedded into a prompt or tool call result.
10461071
*/
10471072
@Serializable
1048-
public data class EmbeddedResource(val resource: ResourceContents) : PromptMessageContent {
1073+
public data class EmbeddedResource(
1074+
/**
1075+
* The contents of the embedded resource.
1076+
*/
1077+
val resource: ResourceContents,
1078+
1079+
/**
1080+
* Optional annotations for the client.
1081+
*/
1082+
val annotations: Annotations? = null,
1083+
) : PromptMessageContent {
10491084
override val type: String = TYPE
10501085

10511086
public companion object {
@@ -1063,6 +1098,34 @@ public enum class Role {
10631098
assistant,
10641099
}
10651100

1101+
/**
1102+
* Optional annotations for the client.
1103+
* The client can use annotations to inform how objects are used or displayed.
1104+
*/
1105+
@Serializable
1106+
public data class Annotations(
1107+
/**
1108+
* Describes who the intended customer of this object or data is.
1109+
*/
1110+
val audience: List<Role>?,
1111+
/**
1112+
* The moment the resource was last modified.
1113+
*/
1114+
@OptIn(ExperimentalTime::class)
1115+
val lastModified: Instant?,
1116+
/**
1117+
* Describes how important this data is for operating the server.
1118+
*
1119+
* A value of 1.0 means "most important", and indicates that the data is effectively required,
1120+
* while 0.0 means "less important", and indicates that the data is entirely optional.
1121+
*/
1122+
val priority: Double?,
1123+
) {
1124+
init {
1125+
require(priority == null || priority in 0.0..1.0) { "Priority must be between 0.0 and 1.0" }
1126+
}
1127+
}
1128+
10661129
/**
10671130
* Describes a message returned as part of a prompt.
10681131
*/

0 commit comments

Comments
 (0)