.end().
All setter methods return this, so you can chain calls:
Required
Create tool call
Create a tool call from a run:Set name
The name is required before calling.end(). If you didn’t provide it when creating the tool call, set it with:
End tool call
End the tool call. A tool call must have a name set before calling.end(). The tool call cannot be modified after calling .end().
Optional tool call data
Set arguments
Set the arguments passed to the tool. Values are automatically serialized to JSON if an object is provided.Set result
Set the result returned by the tool. Values are automatically serialized to JSON if an object is provided.Mark tool call as failed
Sets the status code to error. The tool call cannot be modified after calling.error(). Unlike .end(), calling .error() does not require a name to be set.
Factory pattern
If you have all tool call data available upfront, use thesendToolCall function:
