Record Class SyncResourceRegistration
java.lang.Object
java.lang.Record
org.springframework.ai.mcp.modern.SyncResourceRegistration
- Record Components:
resource- the definition returned byresources/listhandler- the handler forresources/readofresource.uri()
public record SyncResourceRegistration(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpSyncResource handler)
extends Record
A listed resource together with the
McpSyncResource that reads it. The SDK's
McpSyncResource carries no definition, because resources/read also
serves URIs that only match a template; a catalogue of static resources needs the
pairing.- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Constructor Summary
ConstructorsConstructorDescriptionSyncResourceRegistration(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpSyncResource handler) Creates an instance of aSyncResourceRegistrationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.io.modelcontextprotocol.modern.server.feature.McpSyncResourcehandler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.static SyncResourceRegistrationof(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpSyncResource.Handler handler) Pairs a resource with a handler that only works with clients declaringrequiredCapabilities.static SyncResourceRegistrationof(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpSyncResource.Handler handler) Pairs a resource with a handler that requires no client capabilities.io.modelcontextprotocol.modern.McpSchema.Resourceresource()Returns the value of theresourcerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SyncResourceRegistration
public SyncResourceRegistration(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpSyncResource handler) Creates an instance of aSyncResourceRegistrationrecord class.
-
-
Method Details
-
of
public static SyncResourceRegistration of(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpSyncResource.Handler handler) Pairs a resource with a handler that requires no client capabilities.- Since:
- 2.1.0
-
of
public static SyncResourceRegistration of(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpSyncResource.Handler handler) Pairs a resource with a handler that only works with clients declaringrequiredCapabilities. A read from any other client is rejected with-32021without running the handler.- Since:
- 2.1.0
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
resource
public io.modelcontextprotocol.modern.McpSchema.Resource resource()Returns the value of theresourcerecord component.- Returns:
- the value of the
resourcerecord component
-
handler
public io.modelcontextprotocol.modern.server.feature.McpSyncResource handler()Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-