Annotation Interface Tool


@Retention(RUNTIME) @Target(METHOD) public @interface Tool
Annotates a business method of a CDI bean as an exposed tool.

The result of a "tool call" operation is always represented as a ToolResponse. However, the annotated method can also return other types that are converted according to the following rules.

  • If the method returns String then the reponse is success and contains the single TextContent object.
  • If the method returns an implementation of Content then the reponse is success and contains the single content object.
  • If the method returns a List of Content implementations or Strings then the reponse is success and contains the list of relevant content objects.
  • The method may return a
    invalid reference
    Uni
    that wraps any of the type mentioned above.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant value for name() indicating that the annotated element's name should be used as-is.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    An optional description.
    Each tool must have a unique name.
  • Field Details

    • ELEMENT_NAME

      static final String ELEMENT_NAME
      Constant value for name() indicating that the annotated element's name should be used as-is.
      See Also:
  • Element Details

    • name

      String name
      Each tool must have a unique name. By default, the name is derived from the name of the annotated method.
      Default:
      "<<element name>>"
    • description

      String description
      An optional description.
      Default:
      ""