result
Adds a tool result message to the prompt.
Tool results represent the output from executing a tool.
This method ensures that the corresponding tool call message exists in the prompt before adding the result. If the tool call is missing, it will be synthesized and added to maintain proper conversation flow.
Problematic cases could potentially occur, when:
LLM providers concatenate tool names/args and normalize/split them, producing synthesized calls that were not part of the original prompt history
Tool calls with null IDs get processed separately
Parallel tool execution results arrive before calls are recorded in prompt
Parameters
The tool result message to add
Adds a tool result message to the prompt.
This method creates a Message.Tool.Result instance and adds it to the message list. Tool results represent the output from executing a tool with the provided parameters.
Parameters
The unique identifier for the tool result message.
The name of the tool that provided the result.
The content or payload of the tool result.