Class MethodToolCallback
java.lang.Object
org.springframework.ai.tool.method.MethodToolCallback
- All Implemented Interfaces:
ToolCallback
A
ToolCallback
implementation to invoke methods as tools.- Since:
- 1.0.0
- Author:
- Thomas Vitale
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMethodToolCallback
(ToolDefinition toolDefinition, ToolMetadata toolMetadata, Method toolMethod, Object toolObject, ToolCallResultConverter toolCallResultConverter) -
Method Summary
Modifier and TypeMethodDescriptionstatic MethodToolCallback.Builder
builder()
Execute tool with the given input and return the result to send back to the AI model.call
(String toolInput, ToolContext toolContext) Execute tool with the given input and context, and return the result to send back to the AI model.Definition used by the AI model to determine when and how to call the tool.Metadata providing additional information on how to handle the tool.toString()
-
Constructor Details
-
MethodToolCallback
public MethodToolCallback(ToolDefinition toolDefinition, @Nullable ToolMetadata toolMetadata, Method toolMethod, @Nullable Object toolObject, @Nullable ToolCallResultConverter toolCallResultConverter)
-
-
Method Details
-
getToolDefinition
Description copied from interface:ToolCallback
Definition used by the AI model to determine when and how to call the tool.- Specified by:
getToolDefinition
in interfaceToolCallback
-
getToolMetadata
Description copied from interface:ToolCallback
Metadata providing additional information on how to handle the tool.- Specified by:
getToolMetadata
in interfaceToolCallback
-
call
Description copied from interface:ToolCallback
Execute tool with the given input and return the result to send back to the AI model.- Specified by:
call
in interfaceToolCallback
-
call
Description copied from interface:ToolCallback
Execute tool with the given input and context, and return the result to send back to the AI model.- Specified by:
call
in interfaceToolCallback
-
toString
-
builder
-