Resolve sanitized tool-name collisions consistently
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 109
Description
Summary
Add deterministic collision resolution for sanitized tool names. Apply the resolved names consistently when tools are advertised and when tools are dispatched.
Rationale
sanitize_tool_name can map different original names to the same sanitized name. Existing collision paths include ASCII case normalization and over-length truncation. The non-ASCII fallback added in #7625 also uses a truncated hash, so it can collide in principle.
Current consumers can expose duplicate names or overwrite an earlier tool when a dispatch map uses a sanitized name as its key.
Affected areas
lib/crewai/src/crewai/utilities/string_utils.pyget_tool_names- Tool dispatch-map construction in
lib/crewai/src/crewai/utilities/tool_utils.py - Related native function-calling schema generation and regression tests
Required changes
- Define one deterministic collision-resolution step for a collection of tools.
- Preserve the current sanitized name when it is unique.
- Add stable, deterministic suffixes for colliding names.
- Keep every resolved name within the 64-character provider limit.
- Use the same resolved names for advertised tool names and dispatch-map keys.
- Do not rely only on increasing the hash length or on
convert_tools_to_openai_schemaduplicate handling.
Acceptance criteria
- Distinct tools that sanitize to the same base name receive distinct resolved names.
- Resolution is stable for the same tool collection and ordering.
- Resolved names satisfy provider naming and length constraints.
get_tool_names, generated schemas, and tool execution dispatch use matching resolved names.- Tests cover case-normalization collisions, truncation collisions, and dispatch of each colliding tool.
Backlinks
- Pull request: https://github.com/crewAIInc/crewAI/pull/7625
- Review comment: https://github.com/crewAIInc/crewAI/pull/7625#discussion_r4053180631
- Requested by: @CodeWithMoin
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/crewai/src/crewai/utilities/string_utils.py with sanitize_tool_name and get_tool_names, then inspect dispatch-map construction in lib/crewai/src/crewai/utilities/tool_utils.py. Trace the related native function-calling schema generation and regression tests; done means colliding tools receive stable valid names and advertising, schemas, and dispatch use matching names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100