Class ToolResultPart
java.lang.Object
com.codename1.ai.MessagePart
com.codename1.ai.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.-
Constructor Summary
ConstructorsConstructorDescriptionToolResultPart(String toolCallId, String resultJson) resultJsonis the literal JSON string the tool produced. -
Method Summary
-
Constructor Details
-
ToolResultPart
resultJsonis 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:
toolCallId- id of theToolCallbeing answeredresultJson- JSON value returned by the application tool
-
-
Method Details
-
getToolCallId
- Returns:
- provider tool-call id this result answers
-
getResultJson
- Returns:
- application result encoded as JSON
-