Package io.modelcontextprotocol.server
Record Class McpStatelessServerFeatures.SyncResourceTemplateSpecification
java.lang.Object
java.lang.Record
io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceTemplateSpecification
- Record Components:
resourceTemplate- The resource template definition including name, description, and parameter schemareadHandler- The function that handles resource read requests. The function's first argument is anMcpTransportContextupon which the server can interact with the connected client. The second arguments is aMcpSchema.ReadResourceRequest.McpSchema.ResourceTemplateMcpSchema.ReadResourceResult
- Enclosing class:
- McpStatelessServerFeatures
public static record McpStatelessServerFeatures.SyncResourceTemplateSpecification(McpSchema.ResourceTemplate resourceTemplate, BiFunction<McpTransportContext,McpSchema.ReadResourceRequest,McpSchema.ReadResourceResult> readHandler)
extends Record
Specification of a resource template with its synchronous handler function.
Resource templates allow servers to expose parameterized resources using URI
templates: URI
templates.. Arguments may be auto-completed through the
completion API.
Templates support:
- Parameterized resource definitions
- Dynamic content generation
- Consistent resource formatting
- Contextual data injection
-
Constructor Summary
ConstructorsConstructorDescriptionSyncResourceTemplateSpecification(McpSchema.ResourceTemplate resourceTemplate, BiFunction<McpTransportContext, McpSchema.ReadResourceRequest, McpSchema.ReadResourceResult> readHandler) Creates an instance of aSyncResourceTemplateSpecificationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thereadHandlerrecord component.Returns the value of theresourceTemplaterecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SyncResourceTemplateSpecification
public SyncResourceTemplateSpecification(McpSchema.ResourceTemplate resourceTemplate, BiFunction<McpTransportContext, McpSchema.ReadResourceRequest, McpSchema.ReadResourceResult> readHandler) Creates an instance of aSyncResourceTemplateSpecificationrecord class.- Parameters:
resourceTemplate- the value for theresourceTemplaterecord componentreadHandler- the value for thereadHandlerrecord component
-
-
Method Details
-
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). -
resourceTemplate
Returns the value of theresourceTemplaterecord component.- Returns:
- the value of the
resourceTemplaterecord component
-
readHandler
public BiFunction<McpTransportContext,McpSchema.ReadResourceRequest, readHandler()McpSchema.ReadResourceResult> Returns the value of thereadHandlerrecord component.- Returns:
- the value of the
readHandlerrecord component
-