BerriAI/litellm · error · ValueError
Unsupported tool type: {tool['type']}
Error message
Unsupported tool type: {tool['type']} What it means
The tool translation loop matched no known branch: the tool's 'type' is not 'custom'/'function', not a computer_ type, not in ANTHROPIC_HOSTED_TOOLS, not url/mcp/tool_search_*/advisor, so returned_tool and mcp_server are both None and LiteLLM rejects the tool client-side with 'Unsupported tool type: {type}'.
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 6c2dcb801b)
Solutions
- Check the exact type string against Anthropic's current docs (dated suffixes must match exactly, e.g. computer_20250124).
- Upgrade LiteLLM to a version supporting the new tool type.
- If the tool is a plain function tool, use type 'function' with a 'function' payload.
- Filter per-provider tool lists so foreign tool types never reach the Anthropic transformation.
Example fix
# before
tools = [{"type": "computer_2024102", ...}] # typo'd date
# after
tools = [{"type": "computer_20250124", "function": {"name": "computer", "parameters": {...}}}] Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_PREFIXES = ("computer_",) # plus hosted types from litellm constants
from litellm.constants import ANTHROPIC_HOSTED_TOOLS # if available
def validate_tool_types(tools, allowed):
for t in tools:
typ = t.get("type", "")
known = typ in ("function", "custom", "url", "mcp",
"tool_search_tool_regex_20251119",
"tool_search_tool_bm25_20251119") \
or any(typ.startswith(p) for p in allowed)
if not known:
raise ValueError(f"unsupported tool type {typ!r} for anthropic")
return tools Type guard
def tool_type_supported(tool) -> bool:
typ = tool.get("type", "")
return (
typ in ("function", "custom", "url", "mcp",
"tool_search_tool_regex_20251119", "tool_search_tool_bm25_20251119")
or typ.startswith("computer_")
) Prevention
- Copy dated tool type strings verbatim from Anthropic docs.
- Upgrade LiteLLM promptly after Anthropic ships new tool versions.
- Filter cross-provider tool lists per provider before each call.
When it happens
Trigger: Passing a tool with a typo'd or version-mismatched type string (e.g. 'computer_2024102' or a newer Anthropic type than this LiteLLM version knows), or a provider-specific type from another vendor (e.g. Google function declarations) in an anthropic/ call.
Common situations: LiteLLM version lag after Anthropic ships new tool types (new computer/web_search versions are dated strings); typos in hand-written type fields; reusing tool lists across providers without filtering.
Related errors
- Missing required parameter: parameters
- Missing required parameter: display_width_px or display_heig
- Missing required parameter: name
- Tool search tool must have a valid name
- Advisor tool must have a valid model
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/5bdcca8f7b78b38c.
Report an issue: GitHub.