public final class ToolResultPart
- Object
- MessagePart
- ToolResultPart
The result of a tool invocation, sent back to the model so it can
continue reasoning. Pairs with the originating
ToolCall via the
toolCallId. The carrying ChatMessage should use Role.TOOL.
Result content sent back to a model after executing a requested tool call.
The result is JSON text so providers receive the original structured value.Constructors
public ToolResultPart(String toolCallId, String resultJson) | resultJson is the literal JSON string the tool produced. |
Methods
public String getToolCallId() | |
public String getResultJson() |
Inherited methods
Constructor details
ToolResultPart
public ToolResultPart(String toolCallId, String resultJson)resultJson is the literal JSON string the tool produced. If
the tool result isn’t valid JSON, wrap it like
"{\"text\":\"...\"}" – the providers expect JSON-shaped values.
Creates a tool result part.Parameters
toolCallIdString- id of the
ToolCallbeing answered resultJsonString- JSON value returned by the application tool
Method details
getToolCallId
public String getToolCallId()Returns
provider tool-call id this result answers
getResultJson
public String getResultJson()Returns
application result encoded as JSON