Annotation Interface ToolOverride


@Target(METHOD) @Retention(RUNTIME) public @interface ToolOverride
Marks a @Tool method as a replacement for an existing AI tool with the given name.

The annotated method itself must also be annotated with @Tool and declared on a bean that implements JmixAiTool.

During tool registry assembly, when multiple @Tool methods produce the same tool name, the method annotated with @ToolOverride wins and the original one is excluded from the registry.

If the referenced tool name is not present in the registry, a warning is logged and the override is treated as a regular new tool. This fallback fails with an IllegalStateException when the override's own @Tool name is already used by another tool, since the fallback would otherwise silently replace an unrelated tool.

 @Component
 public class MyTools implements DataLoadAiTool {

     @Tool(description = "Improved listing of available entities")
     @ToolOverride("getAvailableEntities")
     public List<EntitySummary> customListing() { ... }
 }
 
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of the existing tool that this method overrides.
  • Element Details

    • value

      String value
      Name of the existing tool that this method overrides. Must match the name value of the original @Tool method (or its derived name, if not explicitly set).
      Returns:
      name of the tool being overridden