Record Class AsyncResourceTemplateRegistration
java.lang.Object
java.lang.Record
org.springframework.ai.mcp.modern.AsyncResourceTemplateRegistration
- Record Components:
template- the definition returned byresources/templates/list, with the handler that completes its variables, if anyhandler- the handler forresources/readof any URI matching the template
public record AsyncResourceTemplateRegistration(io.modelcontextprotocol.modern.server.feature.McpAsyncResourceTemplate template, io.modelcontextprotocol.modern.server.feature.McpAsyncResource handler)
extends Record
The asynchronous twin of
SyncResourceTemplateRegistration: a resource template
together with the McpAsyncResource that reads every URI matching it.- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncResourceTemplateRegistration(io.modelcontextprotocol.modern.server.feature.McpAsyncResourceTemplate template, io.modelcontextprotocol.modern.server.feature.McpAsyncResource handler) Creates an instance of aAsyncResourceTemplateRegistrationrecord 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.of(io.modelcontextprotocol.modern.McpSchema.ResourceTemplate resourceTemplate, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.Handler handler) Pairs a resource template with a handler that only works with clients declaringrequiredCapabilities.of(io.modelcontextprotocol.modern.McpSchema.ResourceTemplate resourceTemplate, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.Handler handler) Pairs a resource template with a handler that requires no client capabilities.io.modelcontextprotocol.modern.server.feature.McpAsyncResourceTemplatetemplate()Returns the value of thetemplaterecord component.final StringtoString()Returns a string representation of this record class.withCompletionHandler(io.modelcontextprotocol.modern.server.feature.McpAsyncCompletionHandler completionHandler) This registration with the template's variables completed bycompletionHandler, when its repository supports completion.
-
Constructor Details
-
AsyncResourceTemplateRegistration
public AsyncResourceTemplateRegistration(io.modelcontextprotocol.modern.server.feature.McpAsyncResourceTemplate template, io.modelcontextprotocol.modern.server.feature.McpAsyncResource handler) Creates an instance of aAsyncResourceTemplateRegistrationrecord class.
-
-
Method Details
-
of
public static AsyncResourceTemplateRegistration of(io.modelcontextprotocol.modern.McpSchema.ResourceTemplate resourceTemplate, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.Handler handler) Pairs a resource template with a handler that requires no client capabilities.- Since:
- 2.1.0
-
of
public static AsyncResourceTemplateRegistration of(io.modelcontextprotocol.modern.McpSchema.ResourceTemplate resourceTemplate, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpAsyncResource.Handler handler) Pairs a resource template 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
-
withCompletionHandler
public AsyncResourceTemplateRegistration withCompletionHandler(io.modelcontextprotocol.modern.server.feature.McpAsyncCompletionHandler completionHandler) This registration with the template's variables completed bycompletionHandler, when its repository supports completion.- 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). -
template
public io.modelcontextprotocol.modern.server.feature.McpAsyncResourceTemplate template()Returns the value of thetemplaterecord component.- Returns:
- the value of the
templaterecord component
-
handler
public io.modelcontextprotocol.modern.server.feature.McpAsyncResource handler()Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-