Interface Tools
- All Known Subinterfaces:
ToolRegistry
- All Known Implementing Classes:
DefaultToolRegistry
public interface Tools
Registry for server tools.
-
Method Summary
Modifier and TypeMethodDescriptionLists the descriptors of all registered tools.Finds a registered tool descriptor by name.register(ToolDescriptor descriptor, ToolFn fn) Registers a tool descriptor with a synchronous function.default Toolsregister(Consumer<ToolDescriptor.Builder> configurer, ToolFn fn) Builds and registers a tool descriptor with a synchronous function.registerAsync(ToolDescriptor descriptor, AsyncToolFn fn) Registers a tool descriptor with an asynchronous function.default ToolsregisterAsync(Consumer<ToolDescriptor.Builder> configurer, AsyncToolFn fn) Builds and registers a tool descriptor with an asynchronous function.booleanunregister(String name) Removes the registered tool with the specified name.
-
Method Details
-
register
Registers a tool descriptor with a synchronous function.- Parameters:
descriptor- the tool descriptorfn- the tool function- Returns:
- this registry
-
register
Builds and registers a tool descriptor with a synchronous function.- Parameters:
configurer- the descriptor builder configurerfn- the tool function- Returns:
- this registry
-
registerAsync
Registers a tool descriptor with an asynchronous function.- Parameters:
descriptor- the tool descriptorfn- the asynchronous tool function- Returns:
- this registry
-
registerAsync
Builds and registers a tool descriptor with an asynchronous function.- Parameters:
configurer- the descriptor builder configurerfn- the asynchronous tool function- Returns:
- this registry
-
unregister
Removes the registered tool with the specified name.- Parameters:
name- the name of the tool to remove- Returns:
trueif a tool was removed,falseif no tool was registered with that name
-
find
Finds a registered tool descriptor by name.- Parameters:
name- the name of the tool to find- Returns:
- the matching tool descriptor, or an empty optional if no tool is registered with that name
-
descriptors
List<ToolDescriptor> descriptors()Lists the descriptors of all registered tools.- Returns:
- the registered tool descriptors
-