Annotation Interface CompensateFor
Marks a method as the compensating action for a
Tool.
When compensation is enabled via .compensateOnToolErrors(true), if any tool
execution fails, all previously executed tools' compensating actions are called in
reverse order to undo their effects.
The annotated method must have the same parameter types as the tool it compensates for,
or accept a single ToolExecution parameter.
Only @Tool-annotated methods support compensating actions. Programmatically
or dynamically defined tools (e.g. MCP tools, tools registered via ToolSpecification)
are not supported.
- Since:
- 1.17.0
-
Required Element Summary
Required Elements
-
Element Details
-
value
String valueThe name of the tool that this method compensates for, as it is exposed to the LLM. This is theTool.name()when it is explicitly set, otherwise the name of the@Tool-annotated method (which is used as the tool name by default).- Returns:
- the name of the tool to compensate for.
-