Package io.openliberty.mcp.features
Interface FeatureManager.FeatureDefinition<INFO extends FeatureManager.FeatureInfo,ARGUMENTS extends FeatureManager.FeatureArguments,RESPONSE,THIS extends FeatureManager.FeatureDefinition<INFO,ARGUMENTS,RESPONSE,THIS>>
- Type Parameters:
INFO- the feature typeARGUMENTS- the argument type accepted by handlers for this featureRESPONSE- the response type returned by handlers for this featureTHIS- this builder
- All Superinterfaces:
org.mcpjava.server.MetaCarrier.Builder<THIS>
- All Known Subinterfaces:
ToolManager.ToolDefinition
- Enclosing interface:
- FeatureManager<INFO extends FeatureManager.FeatureInfo>
public static interface FeatureManager.FeatureDefinition<INFO extends FeatureManager.FeatureInfo,ARGUMENTS extends FeatureManager.FeatureArguments,RESPONSE,THIS extends FeatureManager.FeatureDefinition<INFO,ARGUMENTS,RESPONSE,THIS>>
extends org.mcpjava.server.MetaCarrier.Builder<THIS>
A builder for registering a new feature with the manager.
-
Method Summary
Modifier and TypeMethodDescriptionregister()Creates the feature and registers it with the manager.Sets the function which handles calls to this feature asynchronously.setDescription(String description) Sets the description for the featuresetHandler(Function<ARGUMENTS, RESPONSE> fun) Sets the function which handles calls to this feature.Methods inherited from interface org.mcpjava.server.MetaCarrier.Builder
putMetadata, setMetadata
-
Method Details
-
setDescription
Sets the description for the feature- Parameters:
description- the description- Returns:
- self this builder
-
setHandler
Sets the function which handles calls to this feature.Only one of
setHandler(Function)andsetAsyncHandler(Function)may be called.- Parameters:
fun- the handler function- Returns:
- self this builder
-
setAsyncHandler
Sets the function which handles calls to this feature asynchronously.Only one of
setHandler(Function)andsetAsyncHandler(Function)may be called.- Parameters:
fun- the asynchronous handler function- Returns:
- self this builder
-
register
INFO register()Creates the feature and registers it with the manager.- Returns:
- the newly registered feature
-