Interface ToolExecutor
- All Known Implementing Classes:
DefaultToolExecutor, McpToolExecutor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A low-level executor/handler of a
ToolExecutionRequest
.-
Method Summary
Modifier and TypeMethodDescriptionexecute
(ToolExecutionRequest request, Object memoryId) Executes a tool request.default ToolExecutionResult
executeWithContext
(ToolExecutionRequest request, InvocationContext context) Executes a tool request.
-
Method Details
-
execute
Executes a tool request.- Parameters:
request
- The tool execution request. Contains tool name and arguments.memoryId
- The ID of the chat memory. .- Returns:
- The result of the tool execution that will be sent to the LLM.
-
executeWithContext
default ToolExecutionResult executeWithContext(ToolExecutionRequest request, InvocationContext context) Executes a tool request. Override this method if you wish to:- access the
InvocationParameters
when passing extra data into the tool - propagate the tool result object (ToolExecutionResult.result()
) into theToolExecution
- Parameters:
request
- The tool execution request. Contains tool name and arguments.context
- The AI Service invocation context, containsChatMemory
ID (seeMemoryId
for more details), andInvocationParameters
.- Returns:
- The result of the tool execution that will be sent to the LLM.
-