Package org.springframework.ai.tool
Interface ToolCallback
- All Superinterfaces:
FunctionCallback
- All Known Implementing Classes:
AsyncMcpToolCallback
,FunctionToolCallback
,MethodToolCallback
,SyncMcpToolCallback
Represents a tool whose execution can be triggered by an AI model.
- Since:
- 1.0.0
- Author:
- Thomas Vitale
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.ai.model.function.FunctionCallback
FunctionCallback.Builder, FunctionCallback.CommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>, FunctionCallback.FunctionInvokingSpec<I,
O>, FunctionCallback.MethodInvokingSpec, FunctionCallback.SchemaType -
Method Summary
Modifier and TypeMethodDescriptionExecute tool with the given input and return the result to send back to the AI model.default String
call
(String toolInput, ToolContext tooContext) Execute tool with the given input and context, and return the result to send back to the AI model.default String
Deprecated.default String
Deprecated.default String
getName()
Deprecated.Definition used by the AI model to determine when and how to call the tool.default ToolMetadata
Metadata providing additional information on how to handle the tool.
-
Method Details
-
getToolDefinition
ToolDefinition getToolDefinition()Definition used by the AI model to determine when and how to call the tool. -
getToolMetadata
Metadata providing additional information on how to handle the tool. -
call
Execute tool with the given input and return the result to send back to the AI model.- Specified by:
call
in interfaceFunctionCallback
- Parameters:
toolInput
- JSON string with the function arguments to be passed to the function. The arguments are defined as JSON schema usually registered with the model.- Returns:
- String containing the function call response.
-
call
Execute tool with the given input and context, and return the result to send back to the AI model.- Specified by:
call
in interfaceFunctionCallback
- Parameters:
toolInput
- JSON string with the function arguments to be passed to the function. The arguments are defined as JSON schema usually registered with the model. Arguments are provided by the AI model.- Returns:
- String containing the function call response.
-
getName
Deprecated.- Specified by:
getName
in interfaceFunctionCallback
- Returns:
- Returns the Function name. Unique within the model.
-
getDescription
Deprecated.- Specified by:
getDescription
in interfaceFunctionCallback
- Returns:
- Returns the function description. This description is used by the model do decide if the function should be called or not.
-
getInputTypeSchema
Deprecated.- Specified by:
getInputTypeSchema
in interfaceFunctionCallback
- Returns:
- Returns the JSON schema of the function input type.
-