Annotation Interface AgentTool


@Retention(RUNTIME) @Target(METHOD) public @interface AgentTool
Marks a method as an AI Agent Tool.

Methods annotated with @AgentTool will be available for the AI agent to use when processing user requests. The agent will call these tools based on the user's intent and the tool description.

Example usage:


public class MyPluginTools implements AgentToolProvider {

    @AgentTool(
        name = "get_weather",
        description = "Get the current weather for a location",
        keywords = {"weather", "temperature", "forecast"}
    )
    public String getWeather(AgentToolContext context, String location) {
        return "The weather in " + location + " is sunny, 25°C";
    }
}

Tool methods must:

  • Have AgentToolContext as the first parameter
  • Return a String (the tool's response to the agent)
  • Only use primitive types, String, or simple objects for other parameters
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Permission levels for agent tools.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Description of what the tool does.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether this tool requires DM context.
    boolean
    Whether this tool requires guild context.
    Keywords that help identify when this tool should be used.
    The unique name of the tool.
    Permission level required to use this tool.
    int
    Priority for tool selection when multiple tools match.
  • Element Details

    • name

      String name
      The unique name of the tool. If not specified, the method name will be used.
      Returns:
      tool name
      Default:
      ""
    • description

      String description
      Description of what the tool does. This is shown to the AI agent to help it decide when to use the tool. Should be clear and concise.
      Returns:
      tool description
    • keywords

      String[] keywords
      Keywords that help identify when this tool should be used. The agent may use these to better match user intent.
      Returns:
      array of keywords
      Default:
      {}
    • guildOnly

      boolean guildOnly
      Whether this tool requires guild context. If true, the tool will only be available in guild channels.
      Returns:
      true if guild-only
      Default:
      false
    • dmOnly

      boolean dmOnly
      Whether this tool requires DM context. If true, the tool will only be available in direct messages.
      Returns:
      true if DM-only
      Default:
      false
    • permission

      Permission level required to use this tool. Can be used for access control.
      Returns:
      required permission level
      Default:
      EVERYONE
    • priority

      int priority
      Priority for tool selection when multiple tools match. Higher priority tools are preferred.
      Returns:
      priority (default 0)
      Default:
      0