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.Builderbuilder()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:ToolCallbackDefinition used by the AI model to determine when and how to call the tool.- Specified by:
getToolDefinitionin interfaceToolCallback
-
getToolMetadata
Description copied from interface:ToolCallbackMetadata providing additional information on how to handle the tool.- Specified by:
getToolMetadatain interfaceToolCallback
-
call
Description copied from interface:ToolCallbackExecute tool with the given input and return the result to send back to the AI model.- Specified by:
callin interfaceToolCallback
-
call
Description copied from interface:ToolCallbackExecute tool with the given input and context, and return the result to send back to the AI model.- Specified by:
callin interfaceToolCallback
-
toString
-
builder
-