Interface AgentToolProvider
public interface AgentToolProvider
Interface for classes that provide agent tools.
Plugins can implement this interface and register instances with
the AgentToolRegistry to make tools available to the AI agent.
Example:
public class WeatherTools implements AgentToolProvider {
@AgentTool(
name = "get_weather",
description = "Get weather for a location"
)
public String getWeather(AgentToolContext ctx, String location) {
return "Weather in " + location + ": Sunny, 25°C";
}
@AgentTool(
name = "get_forecast",
description = "Get weather forecast for upcoming days"
)
public String getForecast(AgentToolContext ctx, String location, int days) {
return "Forecast for " + location + " (" + days + " days): ...";
}
}
Then register in your plugin's @OnEnable method:
@Plugin(name = "MyPlugin", version = "1.0.0", author = "Author")
public class MyPlugin {
@OnEnable
public void onEnable(PluginContext context) {
context.getAgentToolRegistry().registerProvider("my-plugin", new WeatherTools());
}
}
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringGet a friendly name for this tool provider.default voidCalled when the provider is registered.default voidCalled when the provider is unregistered.
-
Method Details
-
onRegister
default void onRegister()Called when the provider is registered. Override to perform initialization. -
onUnregister
default void onUnregister()Called when the provider is unregistered. Override to perform cleanup. -
getProviderName
Get a friendly name for this tool provider. Used for logging and debugging.- Returns:
- provider name
-