Annotation Interface ToolArg


@Target(PARAMETER) @Retention(RUNTIME) @Documented public @interface ToolArg
Configures a parameter of a Tool method.

This annotation allows you to provide additional metadata about tool parameters, such as custom names and descriptions that will be included in the tool's JSON Schema definition.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Default value for this parameter when not provided by the client.
    A human-readable description of the parameter.
    The name of the parameter as it appears in the tool's JSON Schema.
    boolean
    Whether this parameter is required.
  • 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.
  • 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
      The name of the parameter as it appears in the tool's JSON Schema.

      Each argument to a tool must have a unique name.

      By default, the parameter name from the method signature will be used (requires compilation with the -parameters flag).

      Returns:
      the parameter name
      Default:
      "<<element name>>"
    • description

      String description
      A human-readable description of the parameter.

      This description will be included in the tool's JSON Schema to help clients understand what this parameter is for.

      Returns:
      the parameter description
      Default:
      ""
    • required

      boolean required
      Whether this parameter is required.

      A parameter is not required if:

      Otherwise, the parameter is required.

      Returns:
      false to make the parameter not required
      Default:
      true
    • defaultValue

      String defaultValue
      Default value for this parameter when not provided by the client.

      The value should be provided as a string and will be converted to the appropriate type by the framework implementation. String, primitive types and their wrappers, and enums are typically converted automatically. For other parameter types, framework-specific converters may be required.

      Setting a default value causes the parameter to not be required, regardless of the value of required().

      Returns:
      the default value as a string
      Default:
      ""