{"record":{"id":"f56e41cc7dbd4b01","repo":"microsoft/autogen","slug":"unsupported-tool-type-type-tool-f56e41","errorCode":null,"errorMessage":"Unsupported tool type: {type(tool)}","messagePattern":"Unsupported tool type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/agents/azure/_azure_ai_agent.py","lineNumber":452,"sourceCode":"                # elif tool == \"sharepoint_grounding\":\n                #     converted_tools.append(SharepointToolDefinition())  # type: ignore\n                else:\n                    raise ValueError(f\"Unsupported tool string: {tool}\")\n            elif isinstance(tool, ToolDefinition):\n                converted_tools.append(tool)\n            elif isinstance(tool, Tool):\n                self._original_tools.append(tool)\n                converted_tools.append(self._convert_tool_to_function_tool_definition(tool))\n            elif callable(tool):\n                if hasattr(tool, \"__doc__\") and tool.__doc__ is not None:\n                    description = tool.__doc__\n                else:\n                    description = \"\"\n                function_tool = FunctionTool(tool, description=description)\n                self._original_tools.append(function_tool)\n                converted_tools.append(self._convert_tool_to_function_tool_definition(function_tool))\n            else:\n                raise ValueError(f\"Unsupported tool type: {type(tool)}\")\n\n    def _convert_tool_to_function_tool_definition(self, tool: Tool) -> FunctionToolDefinition:\n        \"\"\"\n        Convert an autogen Tool to an Azure AI Agent function tool definition.\n\n        Args:\n            tool (Tool): The AutoGen tool to convert\n\n        Returns:\n            models.FunctionToolDefinition: A function tool definition compatible with Azure AI Agent API\n        \"\"\"\n\n        schema = tool.schema\n        parameters: Dict[str, object] = {}\n\n        if \"parameters\" in schema:\n            parameters = {\n                \"type\": schema[\"parameters\"][\"type\"],","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/agents/azure/_azure_ai_agent.py#L434-L470","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\ntools=[{\"type\":\"function\",\"function\":{\"name\":\"f\",\"parameters\":{...}}}]\n# after\nfrom autogen_core.tools import FunctionTool\ntools=[FunctionTool(func, description=\"f\", name=\"f\")]","handlingStrategy":"type-guard","validationCode":"allowed = (str, ToolDefinition, Tool)\ninvalid = [t for t in tools if not (isinstance(t, allowed) or callable(t))]\nif invalid:\n    raise TypeError(f\"Unsupported tool entries: {[type(t).__name__ for t in invalid]}\")","typeGuard":"def is_valid_tool_entry(tool) -> bool:\n    return isinstance(tool, (str, ToolDefinition, Tool)) or callable(tool)","tryCatchPattern":"try:\n    agent = AzureAIAgent(client, tools=tools)\nexcept ValueError as e:\n    if \"Unsupported tool type\" in str(e):\n        tools = [wrap_as_function_tool(t) for t in tools]\n        agent = AzureAIAgent(client, tools=tools)","preventionTips":["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."],"tags":["azure","tools","type-error","azure-ai-agent"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}