Resource

data class Resource(val uri: String, val name: String, val description: String? = null, val mimeType: String? = null, val size: Long? = null, val title: String? = null, val annotations: Annotations? = null, val icons: List<Icon>? = null, val meta: JsonObject? = null) : ResourceLike(source)

A known resource that the server is capable of reading.

Resources represent data sources such as files, database entries, API responses, or other structured data that can be read by clients.

Constructors

Link copied to clipboard
constructor(uri: String, name: String, description: String? = null, mimeType: String? = null, size: Long? = null, title: String? = null, annotations: Annotations? = null, icons: List<Icon>? = null, meta: JsonObject? = null)

Properties

Link copied to clipboard
open val _meta: JsonObject
Link copied to clipboard

Optional annotations for the client. Provides additional metadata and hints about how to use or display this resource.

Link copied to clipboard

A description of what this resource represents. Clients can use this to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.

Link copied to clipboard
val icons: List<Icon>?

Optional set of sized icons that clients can display in their user interface. Clients MUST support at least PNG and JPEG formats. Clients SHOULD also support SVG and WebP formats.

Link copied to clipboard
@SerialName(value = "_meta")
open override val meta: JsonObject?

Optional metadata for this resource.

Link copied to clipboard

The MIME type of this resource, if known (e.g., "text/plain", "application/json", "image/png").

Link copied to clipboard

The programmatic identifier for this resource. Intended for logical use and API identification. If title is not provided, this should be used as a fallback display name.

Link copied to clipboard
val size: Long?

The size of the raw resource content in bytes (i.e., before base64 encoding or any tokenization), if known. Hosts can use this to display file sizes and estimate context window usage.

Link copied to clipboard

Optional human-readable display name for this resource. Intended for UI and end-user contexts, optimized to be easily understood even by those unfamiliar with domain-specific terminology. If not provided, name should be used for display purposes.

Link copied to clipboard
val uri: String

The URI of this resource. Can use any protocol scheme (file://, http://, etc.).