BerriAI/litellm · error · ValueError

Unsupported tool type

Error message

Unsupported tool type: {tool['type']}

What it means

Anthropic tool translation catch-all: the tool's 'type' matches none of the supported kinds (function, computer_, hosted tools, url/mcp, tool_search, advisor), so it cannot be translated to an Anthropic tool definition.

Solutions

  1. Use a supported tool type (e.g. 'custom', 'computer_...', 'bash_...', 'text_editor_...'); remove or convert the unsupported type.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/anthropic/chat/transformation.py:771 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/5bdcca8f7b78b38c. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/anthropic/chat/transformation.py:771

        elif tool["type"] == ANTHROPIC_ADVISOR_TOOL_TYPE:
            from litellm.types.llms.anthropic import AnthropicAdvisorTool

            _tool_dict: Final = cast(dict, tool)
            advisor_model: Final = _tool_dict.get("model")
            if not isinstance(advisor_model, str):
                raise ValueError("Advisor tool must have a valid model")
            _advisor_tool: Final = AnthropicAdvisorTool(
                type=ANTHROPIC_ADVISOR_TOOL_TYPE,
                name="advisor",
                model=advisor_model,
            )
            if _tool_dict.get("max_uses") is not None:
                _advisor_tool["max_uses"] = _tool_dict["max_uses"]
            if _tool_dict.get("caching") is not None:
                _advisor_tool["caching"] = _tool_dict["caching"]
            returned_tool = _advisor_tool
        if returned_tool is None and mcp_server is None:
            raise ValueError(f"Unsupported tool type: {tool['type']}")

        ## check if cache_control is set in the tool
        _cache_control: Final = tool.get("cache_control", None)
        _cache_control_function: Final = tool.get("function", {}).get("cache_control", None)
        if returned_tool is not None:
            # Only set cache_control on tools that support it (not tool search tools)
            tool_type = returned_tool.get("type", "")
            if tool_type not in (
                "tool_search_tool_regex_20251119",
                "tool_search_tool_bm25_20251119",
            ):
                if _cache_control is not None:
                    returned_tool["cache_control"] = _cache_control
                elif _cache_control_function is not None and isinstance(_cache_control_function, dict):
                    returned_tool["cache_control"] = ChatCompletionCachedContent(**_cache_control_function)

        ## check if defer_loading is set in the tool
        _defer_loading: Final = tool.get("defer_loading", None)

View on GitHub (pinned to 77b7c6c40c)