fix: use consistent casefold().strip() comparison for add_image tool name

Address Bugbot feedback: ensure both tool_usage.py and crew_agent_executor.py
use the same comparison approach (casefold().strip()) for detecting the
add_image tool, preventing edge cases where fuzzy matching could cause
inconsistent behavior.

Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
Devin AI
2025-12-02 10:28:40 +00:00
parent 29d40de651
commit cff9cfb665

View File

@@ -320,7 +320,8 @@ class ToolUsage:
add_image_tool = self._i18n.tools("add_image")
is_add_image_tool = (
isinstance(add_image_tool, dict)
and tool.name == add_image_tool.get("name", "")
and tool.name.casefold().strip()
== add_image_tool.get("name", "").casefold().strip()
)
if not is_add_image_tool:
result = self._format_result(result=result)