microsoft/autogen · error · ValueError
Unsupported tool type: {type(tool)}
Error message
Unsupported tool type: {type(tool)} What it means
Raised in AzureAIAgent's tool-conversion loop when a tools entry is neither a string, a ToolDefinition, a Tool, nor a callable. The converter dispatches on type; anything else (dict, None, a dataclass, a string variable that's actually a schema) hits the else branch and raises with the offending type name.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/agents/azure/_azure_ai_agent.py:452
# elif tool == "sharepoint_grounding":
# converted_tools.append(SharepointToolDefinition()) # type: ignore
else:
raise ValueError(f"Unsupported tool string: {tool}")
elif isinstance(tool, ToolDefinition):
converted_tools.append(tool)
elif isinstance(tool, Tool):
self._original_tools.append(tool)
converted_tools.append(self._convert_tool_to_function_tool_definition(tool))
elif callable(tool):
if hasattr(tool, "__doc__") and tool.__doc__ is not None:
description = tool.__doc__
else:
description = ""
function_tool = FunctionTool(tool, description=description)
self._original_tools.append(function_tool)
converted_tools.append(self._convert_tool_to_function_tool_definition(function_tool))
else:
raise ValueError(f"Unsupported tool type: {type(tool)}")
def _convert_tool_to_function_tool_definition(self, tool: Tool) -> FunctionToolDefinition:
"""
Convert an autogen Tool to an Azure AI Agent function tool definition.
Args:
tool (Tool): The AutoGen tool to convert
Returns:
models.FunctionToolDefinition: A function tool definition compatible with Azure AI Agent API
"""
schema = tool.schema
parameters: Dict[str, object] = {}
if "parameters" in schema:
parameters = {
"type": schema["parameters"]["type"],View on GitHub (pinned to 027ecf0a37)
Solutions
- Wrap function schemas in FunctionTool/Tool instances or pass callables; let the agent convert them.
- If you have an Azure SDK ToolDefinition, import it from the same azure-ai-projects package version the agent uses so isinstance checks pass.
- Sanitize the list before construction: filter None and reject non-(str|ToolDefinition|Tool|callable) entries with a clear error.
Example fix
# before
tools=[{"type":"function","function":{"name":"f","parameters":{...}}}]
# after
from autogen_core.tools import FunctionTool
tools=[FunctionTool(func, description="f", name="f")] Defensive patterns
Strategy: type-guard
Validate before calling
allowed = (str, ToolDefinition, Tool)
invalid = [t for t in tools if not (isinstance(t, allowed) or callable(t))]
if invalid:
raise TypeError(f"Unsupported tool entries: {[type(t).__name__ for t in invalid]}") Type guard
def is_valid_tool_entry(tool) -> bool:
return isinstance(tool, (str, ToolDefinition, Tool)) or callable(tool) Try / catch
try:
agent = AzureAIAgent(client, tools=tools)
except ValueError as e:
if "Unsupported tool type" in str(e):
tools = [wrap_as_function_tool(t) for t in tools]
agent = AzureAIAgent(client, tools=tools) Prevention
- Never pass raw OpenAI dict tool specs; wrap them as FunctionTool.
- Import ToolDefinition from the same azure-ai-projects version the agent uses.
- Filter None out of dynamically built tool lists.
When it happens
Trigger: Passing raw OpenAI-style JSON tool dicts (e.g. {"type":"function","function":{...}}), None entries, or ORM/dataclass objects in the tools list at construction or via set_tools.
Common situations: Porting code from the raw OpenAI/Azure REST API or other agent frameworks that use dict tool specs; a tools list built dynamically where one element is None; passing a ToolDefinition from a mismatched SDK version that no longer isinstance-checks.
Related errors
- Unsupported tool string: {tool}
- The tool '{tool_call.name}' is not available.
- File search is not enabled for this assistant. Add a file_se
- Thread not initialized
- Agent not initialized
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/f56e41cc7dbd4b01.
Report an issue: GitHub.