Class McpResourceLink
java.lang.Object
com.soklet.McpResourceLink
- All Implemented Interfaces:
McpContentBlock
Immutable MCP content block linking to a resource.
When returned as tool content, optional icons are omitted from the
2025-06-18 wire projection and retained for 2025-11-25 and
the modern revision. Projection does not mutate this value.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable builder for immutableMcpResourceLink. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic @NonNull McpResourceLinkfromResourceDescriptor(@NonNull McpResourceDescriptor resourceDescriptor) Creates a resource-link content block from an existing concrete resource descriptor.Returns optional presentation annotations for this content block.getIcons()Returns protocol extension metadata associated with this content block.getName()getTitle()getUri()inthashCode()static @NonNull McpResourceLink.BuilderwithUriAndName(@NonNull URI uri, @NonNull String name) Vends a builder primed with the linked resource URI and name.
-
Method Details
-
withUriAndName
public static @NonNull McpResourceLink.Builder withUriAndName(@NonNull URI uri, @NonNull String name) Vends a builder primed with the linked resource URI and name.- Parameters:
uri- absolute normalized resource URI in ASCII wire formname- resource name- Returns:
- resource-link builder
- Throws:
IllegalArgumentException- if the URI is relative, not normalized, not in ASCII wire form, or the name is blank
-
fromResourceDescriptor
public static @NonNull McpResourceLink fromResourceDescriptor(@NonNull McpResourceDescriptor resourceDescriptor) Creates a resource-link content block from an existing concrete resource descriptor. Every descriptor property is preserved.- Parameters:
resourceDescriptor- resource descriptor to copy- Returns:
- immutable resource link
- Throws:
NullPointerException- ifresourceDescriptoris null
-
getUri
-
getName
-
getTitle
-
getDescription
- Returns:
- human-readable description, if supplied
-
getMimeType
- Returns:
- resource MIME type, if supplied
-
getIcons
-
getAnnotations
Description copied from interface:McpContentBlockReturns optional presentation annotations for this content block.- Specified by:
getAnnotationsin interfaceMcpContentBlock- Returns:
- content annotations, if supplied
-
getSizeInBytes
- Returns:
- resource size in bytes, if supplied
-
getMetadata
Description copied from interface:McpContentBlockReturns protocol extension metadata associated with this content block.- Specified by:
getMetadatain interfaceMcpContentBlock- Returns:
- immutable extension metadata
-
equals
-
hashCode
-