.end().
All setter methods return self, so you can chain calls:
Required
Create tool call
There are two ways to create a tool call:| Parameter | Required | Description |
|---|---|---|
tool_name | No | The name of the tool (can be set later with .name()) |
tool_call_id | No | Custom tool call ID. If not provided, a UUID is automatically generated. |
Set name
The name is required before calling.end(). If you didn’t provide it when creating the tool call, set it with:
| Parameter | Required | Description |
|---|---|---|
tool_name | Yes | The name of the tool |
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 a dictionary is provided.| Parameter | Required | Description |
|---|---|---|
value | Yes | Arguments passed to the tool (string or dictionary) |
Set result
Set the result returned by the tool. Values are automatically serialized to JSON if a dictionary is provided.| Parameter | Required | Description |
|---|---|---|
value | Yes | Result returned by the tool (string or dictionary) |
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.
| Parameter | Required | Description |
|---|---|---|
status_message | No | A description of the error |
