Record Class SyncResourceTemplateRegistration
java.lang.Object
java.lang.Record
org.springframework.ai.mcp.modern.SyncResourceTemplateRegistration
- 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 SyncResourceTemplateRegistration(io.modelcontextprotocol.modern.server.feature.McpSyncResourceTemplate template, io.modelcontextprotocol.modern.server.feature.McpSyncResource handler)
extends Record
A resource template together with the
McpSyncResource that reads every URI
matching it. See SyncResourceRegistration for why the pairing lives here: the
SDK's McpSyncResourceTemplate carries the definition and the completion
handler, but not the read handler.- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Constructor Summary
ConstructorsConstructorDescriptionSyncResourceTemplateRegistration(io.modelcontextprotocol.modern.server.feature.McpSyncResourceTemplate template, io.modelcontextprotocol.modern.server.feature.McpSyncResource handler) Creates an instance of aSyncResourceTemplateRegistrationrecord 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.of(io.modelcontextprotocol.modern.McpSchema.ResourceTemplate resourceTemplate, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpSyncResource.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.McpSyncResource.Handler handler) Pairs a resource template with a handler that requires no client capabilities.io.modelcontextprotocol.modern.server.feature.McpSyncResourceTemplatetemplate()Returns the value of thetemplaterecord component.final StringtoString()Returns a string representation of this record class.withCompletionHandler(io.modelcontextprotocol.modern.server.feature.McpSyncCompletionHandler completionHandler) This registration with the template's variables completed bycompletionHandler, when its repository supports completion.
-
Constructor Details
-
SyncResourceTemplateRegistration
public SyncResourceTemplateRegistration(io.modelcontextprotocol.modern.server.feature.McpSyncResourceTemplate template, io.modelcontextprotocol.modern.server.feature.McpSyncResource handler) Creates an instance of aSyncResourceTemplateRegistrationrecord class.
-
-
Method Details
-
of
public static SyncResourceTemplateRegistration of(io.modelcontextprotocol.modern.McpSchema.ResourceTemplate resourceTemplate, io.modelcontextprotocol.modern.server.feature.McpSyncResource.Handler handler) Pairs a resource template with a handler that requires no client capabilities.- Since:
- 2.1.0
-
of
public static SyncResourceTemplateRegistration of(io.modelcontextprotocol.modern.McpSchema.ResourceTemplate resourceTemplate, io.modelcontextprotocol.modern.McpSchema.ClientCapabilities requiredCapabilities, io.modelcontextprotocol.modern.server.feature.McpSyncResource.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 SyncResourceTemplateRegistration withCompletionHandler(io.modelcontextprotocol.modern.server.feature.McpSyncCompletionHandler 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.McpSyncResourceTemplate template()Returns the value of thetemplaterecord component.- Returns:
- the value of the
templaterecord component
-
handler
public io.modelcontextprotocol.modern.server.feature.McpSyncResource handler()Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-