Uses of Class
dev.langchain4j.service.tool.ToolExecutionResult
Packages that use ToolExecutionResult
Package
Description
-
Uses of ToolExecutionResult in dev.langchain4j.mcp
Methods in dev.langchain4j.mcp that return ToolExecutionResultModifier and TypeMethodDescriptionMcpToolExecutor.executeWithContext(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Methods in dev.langchain4j.mcp that return types with arguments of type ToolExecutionResultModifier and TypeMethodDescriptionMcpToolExecutor.executeAsync(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Non-blocking counterpart ofToolExecutor.executeWithContext(ToolExecutionRequest, InvocationContext), invoked by the asynchronous AI Service tool loop (AI Service methods returningCompletableFutureorCompletionStage), which composes the returned future instead of waiting on a thread. -
Uses of ToolExecutionResult in dev.langchain4j.mcp.client
Methods in dev.langchain4j.mcp.client that return ToolExecutionResultModifier and TypeMethodDescriptionDefaultMcpClient.executeTool(ToolExecutionRequest executionRequest) DefaultMcpClient.executeTool(ToolExecutionRequest executionRequest, InvocationContext invocationContext) McpClient.executeTool(ToolExecutionRequest executionRequest) Executes a tool on the MCP server and returns the result.McpClient.executeTool(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Executes a tool on the MCP server and returns the result.DefaultMcpToolResultExtractor.extract(com.fasterxml.jackson.databind.JsonNode content, boolean isError) Deprecated, for removal: This API element is subject to removal in a future version.McpToolResultExtractor.extract(com.fasterxml.jackson.databind.JsonNode content, boolean isError) Deprecated, for removal: This API element is subject to removal in a future version.Extracts aToolExecutionResultfromCallToolResult.result.content[].Methods in dev.langchain4j.mcp.client that return types with arguments of type ToolExecutionResultModifier and TypeMethodDescriptionDefaultMcpClient.executeToolAsync(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Non-blocking counterpart ofMcpClient.executeTool(ToolExecutionRequest, InvocationContext): executes a tool on the MCP server without holding a thread while the result is in flight.default CompletableFuture<ToolExecutionResult> McpClient.executeToolAsync(ToolExecutionRequest executionRequest, InvocationContext invocationContext) Non-blocking counterpart ofMcpClient.executeTool(ToolExecutionRequest, InvocationContext): executes a tool on the MCP server without holding a thread while the result is in flight.Methods in dev.langchain4j.mcp.client with parameters of type ToolExecutionResultModifier and TypeMethodDescriptiondefault voidMcpClientListener.afterExecuteTool(McpCallContext context, ToolExecutionResult result, Map<String, Object> rawResult) Called after executing a tool if the execution was successful, or if it resulted in an application-level error (but not a protocol-level or communication error). -
Uses of ToolExecutionResult in dev.langchain4j.service.tool
Methods in dev.langchain4j.service.tool that return ToolExecutionResultModifier and TypeMethodDescriptionToolService.applyToolHallucinationStrategy(ToolExecutionRequest toolRequest) ToolExecutionResult.Builder.build()Builds aToolExecutionResult.ToolService.executeTool(InvocationContext invocationContext, Map<String, ToolExecutor> toolExecutors, ToolExecutionRequest toolRequest, Consumer<BeforeToolExecution> externalBeforeToolExecution, Consumer<ToolExecution> externalAfterToolExecution) DefaultToolExecutor.executeWithContext(ToolExecutionRequest request, InvocationContext context) default ToolExecutionResultToolExecutor.executeWithContext(ToolExecutionRequest request, InvocationContext context) Executes a tool request.static ToolExecutionResultToolService.executeWithErrorHandling(ToolExecutionRequest toolRequest, ToolExecutor toolExecutor, InvocationContext invocationContext, ToolArgumentsErrorHandler argumentsErrorHandler, ToolExecutionErrorHandler executionErrorHandler) Methods in dev.langchain4j.service.tool that return types with arguments of type ToolExecutionResultModifier and TypeMethodDescriptionDefaultToolExecutor.executeAsync(ToolExecutionRequest request, InvocationContext context) Non-blocking counterpart ofToolExecutor.executeWithContext(ToolExecutionRequest, InvocationContext), invoked by the asynchronous AI Service tool loop (AI Service methods returningCompletableFutureorCompletionStage), which composes the returned future instead of waiting on a thread.default CompletableFuture<ToolExecutionResult> ToolExecutor.executeAsync(ToolExecutionRequest request, InvocationContext context) Non-blocking counterpart ofToolExecutor.executeWithContext(ToolExecutionRequest, InvocationContext), invoked by the asynchronous AI Service tool loop (AI Service methods returningCompletableFutureorCompletionStage), which composes the returned future instead of waiting on a thread.ToolService.CombinedToolResults.results()Returns the value of theresultsrecord component.ToolService.startTool(ToolExecutionRequest toolRequest, Map<String, ToolExecutor> toolExecutors, InvocationContext invocationContext, Consumer<BeforeToolExecution> externalBeforeToolExecution, Consumer<ToolExecution> externalAfterToolExecution, Executor executor) Initiates a single tool execution on the givenexecutor, returning a future of its result.Methods in dev.langchain4j.service.tool with parameters of type ToolExecutionResultMethod parameters in dev.langchain4j.service.tool with type arguments of type ToolExecutionResultModifier and TypeMethodDescriptionToolService.collectCompensableRound(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolService.CompensableToolExecution> compensableExecutions, InvocationContext invocationContext) Records one completed round's successful compensable tool executions into the sharedaccumulatorand returns the first errored tool's name (ornull).ToolService.combineToolResultsCollectingErrors(Map<ToolExecutionRequest, CompletableFuture<ToolExecutionResult>> futures) Combines a set of in-flight (possibly already-started) tool executions into a single future of their results, keyed and ordered by request.voidToolService.compensateIfNeeded(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, AiServiceListenerRegistrar listenerRegistrar) Synchronous tool compensation, used by the synchronous /TokenStreammodes.ToolService.compensateIfNeededAsync(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, CompensationReason reason, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter) Non-blocking counterpart ofToolService.compensateIfNeeded(List, Map, List, List, boolean, ChatMemory, List, InvocationContext, AiServiceListenerRegistrar), used by theCompletableFutureand reactive modes.ToolService.compensateIfNeededAsync(List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecutionResultMessage> resultMessages, List<ToolService.CompensableToolExecution> compensableExecutions, boolean anyToolErrored, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, CompensationReason reason, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter, boolean alreadyCollected, String preCollectedFailedToolName) AsToolService.compensateIfNeededAsync(List, Map, List, List, boolean, ChatMemory, List, InvocationContext, CompensationReason, AiServiceListenerRegistrar, BiConsumer), but whenalreadyCollectedistruethis round's compensable tools have already been recorded intocompensableExecutions(viaToolService.collectCompensableRound(List, Map, List, InvocationContext)) andpreCollectedFailedToolNamecarries the collect's result; the collection step is then skipped.ToolService.compensateOnCancellationAsync(List<ToolExecutionRequest> currentRoundRequests, Map<ToolExecutionRequest, ToolExecutionResult> currentRoundResults, List<ToolService.CompensableToolExecution> compensableExecutions, ChatMemory chatMemory, List<ChatMessage> messages, InvocationContext invocationContext, AiServiceListenerRegistrar listenerRegistrar, BiConsumer<ToolExecution, CompensationReason> streamEmitter) Rolls back, on cancellation, every compensable tool that had already executed successfully - across all rounds - implementing the "drain the round, then roll back" contract for the asynchronous and reactive modes.ToolService.prepareNextChatRequest(AiServiceContext context, Object memoryId, List<ChatMessage> messages, InvocationContext invocationContext, ToolServiceContext toolServiceContext, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, ChatRequestParameters parameters) Builds the next round'sChatRequest, shared by every AI Service mode: given the already-resolvedmessagesto send (seeToolService.resolveMessagesForNextRequest(List, AiServiceContext, InvocationContext)), it refreshes dynamic tool providers, folds in any tools found by tool search, overrides the tool specifications on the carried-forwardparameters, applies the chat-request transformer, and fires theAiServiceRequestIssuedEvent.ToolService.processToolResults(AiServiceContext context, List<ToolExecutionRequest> toolExecutionRequests, Map<ToolExecutionRequest, ToolExecutionResult> toolResults, List<ToolExecution> toolExecutions, InvocationContext invocationContext, ToolServiceContext toolServiceContext) Per-round bookkeeping shared by every AI Service mode (sync,CompletableFuture,TokenStream, reactiveFlow.Publisher): for each executed tool it records aToolExecution, fires theToolExecutedEvent, collects the tool-result message (in request order), and accumulatesanyToolErrored+ the per-toolReturnBehaviors.Constructor parameters in dev.langchain4j.service.tool with type arguments of type ToolExecutionResultModifierConstructorDescriptionCombinedToolResults(Map<ToolExecutionRequest, ToolExecutionResult> results, Throwable firstError) Creates an instance of aCombinedToolResultsrecord class. -
Uses of ToolExecutionResult in dev.langchain4j.service.tool.search
Method parameters in dev.langchain4j.service.tool.search with type arguments of type ToolExecutionResultModifier and TypeMethodDescriptionstatic ToolServiceContextToolSearchService.addFoundTools(ToolServiceContext toolServiceContext, Collection<ToolExecutionResult> toolResults)