Skip to content

tinker_cookbook.tool_use.error_tool_result

tinker_cookbook.tool_use.error_tool_result(error_msg, call_id, name, error_type, should_stop)

Helper function to create an error ToolResult.

Parameters:

  • error_msg (str) – The error message to return.
  • call_id (str) – The tool call ID (usually from ToolInput).
  • name (str) – The tool name.
  • error_type (str) – Error category for metadata (e.g., "validation_failed").
  • should_stop (bool) – Whether to stop the episode after this error.

Returns: A ToolResult with error message and metadata.