Record Class AsyncResourceRegistration
java.lang.Object
java.lang.Record
org.springframework.ai.mcp.modern.AsyncResourceRegistration
- Record Components:
resource- the definition returned byresources/listhandler- the handler forresources/readofresource.uri()
public record AsyncResourceRegistration(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpAsyncResource handler)
extends Record
The asynchronous twin of
SyncResourceRegistration: a listed resource together
with the McpAsyncResource that reads it.- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncResourceRegistration(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpAsyncResource handler) Creates an instance of aAsyncResourceRegistrationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.io.modelcontextprotocol.modern.server.feature.McpAsyncResourcehandler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.static AsyncResourceRegistrationof(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.Handler handler) Pairs a resource with a handler that only works with clients declaringrequiredCapabilities.static AsyncResourceRegistrationof(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.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
-
AsyncResourceRegistration
public AsyncResourceRegistration(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpAsyncResource handler) Creates an instance of aAsyncResourceRegistrationrecord class.
-
-
Method Details
-
of
public static AsyncResourceRegistration of(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.Handler handler) Pairs a resource with a handler that requires no client capabilities.- Since:
- 2.1.0
-
of
public static AsyncResourceRegistration of(io.modelcontextprotocol.modern.McpSchema.Resource resource, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.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.McpAsyncResource handler()Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-