Skip to content

Commit 5f4ca3d

Browse files
committed
Added ResourceLink type (#158)
1 parent f022193 commit 5f4ca3d

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

kotlin-sdk-core/api/kotlin-sdk-core.api

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,6 +2285,48 @@ public final class io/modelcontextprotocol/kotlin/sdk/ResourceContents$Companion
22852285
public final fun serializer ()Lkotlinx/serialization/KSerializer;
22862286
}
22872287

2288+
public final class io/modelcontextprotocol/kotlin/sdk/ResourceLink : io/modelcontextprotocol/kotlin/sdk/ContentBlock {
2289+
public static final field Companion Lio/modelcontextprotocol/kotlin/sdk/ResourceLink$Companion;
2290+
public static final field TYPE Ljava/lang/String;
2291+
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/modelcontextprotocol/kotlin/sdk/Annotations;)V
2292+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/modelcontextprotocol/kotlin/sdk/Annotations;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
2293+
public final fun component1 ()Ljava/lang/String;
2294+
public final fun component2 ()Ljava/lang/String;
2295+
public final fun component3 ()Ljava/lang/Long;
2296+
public final fun component4 ()Ljava/lang/String;
2297+
public final fun component5 ()Ljava/lang/String;
2298+
public final fun component6 ()Ljava/lang/String;
2299+
public final fun component7 ()Lio/modelcontextprotocol/kotlin/sdk/Annotations;
2300+
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/modelcontextprotocol/kotlin/sdk/Annotations;)Lio/modelcontextprotocol/kotlin/sdk/ResourceLink;
2301+
public static synthetic fun copy$default (Lio/modelcontextprotocol/kotlin/sdk/ResourceLink;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lio/modelcontextprotocol/kotlin/sdk/Annotations;ILjava/lang/Object;)Lio/modelcontextprotocol/kotlin/sdk/ResourceLink;
2302+
public fun equals (Ljava/lang/Object;)Z
2303+
public final fun getAnnotations ()Lio/modelcontextprotocol/kotlin/sdk/Annotations;
2304+
public final fun getDescription ()Ljava/lang/String;
2305+
public final fun getMimeType ()Ljava/lang/String;
2306+
public final fun getName ()Ljava/lang/String;
2307+
public final fun getSize ()Ljava/lang/Long;
2308+
public final fun getTitle ()Ljava/lang/String;
2309+
public fun getType ()Ljava/lang/String;
2310+
public final fun getUri ()Ljava/lang/String;
2311+
public fun hashCode ()I
2312+
public fun toString ()Ljava/lang/String;
2313+
}
2314+
2315+
public final synthetic class io/modelcontextprotocol/kotlin/sdk/ResourceLink$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
2316+
public static final field INSTANCE Lio/modelcontextprotocol/kotlin/sdk/ResourceLink$$serializer;
2317+
public final fun childSerializers ()[Lkotlinx/serialization/KSerializer;
2318+
public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lio/modelcontextprotocol/kotlin/sdk/ResourceLink;
2319+
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
2320+
public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
2321+
public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Lio/modelcontextprotocol/kotlin/sdk/ResourceLink;)V
2322+
public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
2323+
public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
2324+
}
2325+
2326+
public final class io/modelcontextprotocol/kotlin/sdk/ResourceLink$Companion {
2327+
public final fun serializer ()Lkotlinx/serialization/KSerializer;
2328+
}
2329+
22882330
public final class io/modelcontextprotocol/kotlin/sdk/ResourceListChangedNotification : io/modelcontextprotocol/kotlin/sdk/ServerNotification {
22892331
public static final field Companion Lio/modelcontextprotocol/kotlin/sdk/ResourceListChangedNotification$Companion;
22902332
public fun <init> ()V

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

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,62 @@ public data class AudioContent(
10721072
}
10731073
}
10741074

1075+
/**
1076+
* A Resource Link provided to or from an LLM.
1077+
*/
1078+
@Serializable
1079+
public data class ResourceLink(
1080+
/**
1081+
* A description of what this resource represents.
1082+
*
1083+
* This can be used by clients to improve the LLM’s understanding of available resources. It can be thought of like a “hint” to the model.
1084+
*
1085+
*/
1086+
val description: String? = null,
1087+
1088+
/**
1089+
* Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
1090+
*/
1091+
val name: String,
1092+
1093+
/**
1094+
* The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
1095+
*
1096+
* This can be used by Hosts to display file sizes and estimate context window usage.
1097+
*
1098+
*/
1099+
val size: Long? = null,
1100+
1101+
/**
1102+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.
1103+
*
1104+
* If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).
1105+
*
1106+
*/
1107+
val title: String? = null,
1108+
1109+
/**
1110+
* The URI of this resource.
1111+
*/
1112+
val uri: String,
1113+
1114+
/**
1115+
* The MIME type of this resource, if known.
1116+
*/
1117+
val mimeType: String,
1118+
1119+
/**
1120+
* Optional annotations for the client.
1121+
*/
1122+
val annotations: Annotations? = null,
1123+
) : ContentBlock {
1124+
override val type: String = TYPE
1125+
1126+
public companion object {
1127+
public const val TYPE: String = "resource_link"
1128+
}
1129+
}
1130+
10751131
/**
10761132
* Unknown content provided to or from an LLM.
10771133
*/

0 commit comments

Comments
 (0)