Annotation Type AIToolMethod
Annotation used to mark a static method as a tool (function) that can be
called by the AI model.
Methods annotated with @AIToolMethod are automatically discovered
by the ToolManager and exposed to the Gemini API as function
declarations.
- Author:
- Anahata
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionDefines how the output of this tool should be treated within the chat context.booleanDetermines whether the user must explicitly approve the execution of this tool via a confirmation dialog.
-
Element Details
-
value
String valueA detailed, human-readable description of what the tool does. This description is sent to the model to help it understand when and how to use the tool.- Returns:
- The tool description.
-
requiresApproval
boolean requiresApprovalDetermines whether the user must explicitly approve the execution of this tool via a confirmation dialog.Set to
falsefor safe, read-only operations (e.g., reading a file). Defaults totruefor safety.- Returns:
trueif approval is required,falseotherwise.
- Default:
true
-
behavior
ContextBehavior behaviorDefines how the output of this tool should be treated within the chat context.Use
ContextBehavior.EPHEMERALfor one-off actions andContextBehavior.STATEFUL_REPLACEfor tools that return persistent resources like file contents.- Returns:
- The context behavior.
- Default:
EPHEMERAL
-
