Annotation Interface ToolArg


@Retention(RUNTIME) @Target(PARAMETER) public @interface ToolArg
Annotates a parameter of a Tool method.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The default value is used when an MCP client does not provide an argument value.
     
     
    boolean
    An argument is required by default unless no annotation value is set explicitly and the type of the annotated parameter is Optional or the default value is set with defaultValue().
  • 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
      Default:
      "<<element name>>"
    • description

      String description
      Default:
      ""
    • required

      boolean required
      An argument is required by default unless no annotation value is set explicitly and the type of the annotated parameter is Optional or the default value is set with defaultValue().
      Default:
      true
    • defaultValue

      String defaultValue
      The default value is used when an MCP client does not provide an argument value.

      String, primitive types and corresponding wrappers, and enums are converted automatically. For any other parameter type a custom DefaultValueConverter is needed.

      See Also:
      • DefaultValueConverter
      Default:
      ""