Class DefaultToolRegistry
java.lang.Object
dev.tachyonmcp.core.server.features.AbstractRegistry<ToolDescriptor,ToolHandler>
dev.tachyonmcp.core.server.features.tools.DefaultToolRegistry
- All Implemented Interfaces:
Tools,ToolRegistry
@InternalApi
public class DefaultToolRegistry
extends AbstractRegistry<ToolDescriptor,ToolHandler>
implements ToolRegistry
AbstractRegistry for tool handlers with input/output schema validation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum description length before a warning is logged. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultToolRegistry(JsonSchemaFactory<String> schemaFactory, FeatureConfig config) Creates a tool registry with the given schema validators and payload serde. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves all registered tool descriptors in name order.Finds the descriptor for a registered tool by name.register(ToolDescriptor descriptor, ToolFn fn) Registers a tool descriptor with a synchronous function.registerAsync(ToolDescriptor descriptor, AsyncToolFn fn) Registers a tool descriptor with an asynchronous function.booleanunregister(String name) Removes the registered tool with the specified name.Methods inherited from class dev.tachyonmcp.core.server.features.AbstractRegistry
addItem, addItemIfAbsent, defaultPageSize, fireOnChange, get, getAll, isEmpty, list, list, listItems, onChange, removeItemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.tachyonmcp.api.server.features.tools.Tools
register, registerAsync
-
Field Details
-
MAX_DESCRIPTION_LENGTH
public static final int MAX_DESCRIPTION_LENGTHMaximum description length before a warning is logged. MCP clients may truncate descriptions beyond this length.- See Also:
-
-
Constructor Details
-
DefaultToolRegistry
Creates a tool registry with the given schema validators and payload serde.
-
-
Method Details
-
register
Description copied from interface:ToolsRegisters a tool descriptor with a synchronous function. -
registerAsync
Description copied from interface:ToolsRegisters a tool descriptor with an asynchronous function.- Specified by:
registerAsyncin interfaceTools- Parameters:
descriptor- the tool descriptorfn- the asynchronous tool function- Returns:
- this registry
-
unregister
Removes the registered tool with the specified name.- Specified by:
unregisterin interfaceTools- Parameters:
name- the name of the tool to remove- Returns:
trueif a tool was removed,falseotherwise
-
find
Finds the descriptor for a registered tool by name. -
descriptors
Retrieves all registered tool descriptors in name order.- Specified by:
descriptorsin interfaceTools- Returns:
- the registered tool descriptors sorted by name
-