{"record":{"id":"e5e870a34c111611","repo":"microsoft/semantic-kernel","slug":"unsupported-bing-tool-call-type-type-bing-tool-c","errorCode":null,"errorMessage":"Unsupported Bing tool call type: {type(bing_tool_call)}","messagePattern":"Unsupported Bing tool call type: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/azure_ai/agent_content_generation.py","lineNumber":311,"sourceCode":"    )\n    return function_call_content\n\n\n@experimental\ndef generate_bing_grounding_content(\n    agent_name: str, bing_tool_call: \"RunStepBingGroundingToolCall | RunStepBingCustomSearchToolCall\"\n) -> ChatMessageContent:\n    \"\"\"Generate function result content related to a Bing Grounding Tool or Bing Custom Search Tool.\"\"\"\n    message_content: ChatMessageContent = ChatMessageContent(role=AuthorRole.ASSISTANT, name=agent_name)  # type: ignore\n\n    # Extract tool details based on the specific tool type\n    if isinstance(bing_tool_call, RunStepBingGroundingToolCall):\n        tool_details = bing_tool_call.bing_grounding\n    elif isinstance(bing_tool_call, RunStepBingCustomSearchToolCall):\n        tool_details = bing_tool_call.bing_custom_search\n    else:\n        # This should never happen with proper typing, but provides safety\n        raise TypeError(f\"Unsupported Bing tool call type: {type(bing_tool_call)}\")\n\n    message_content.items.append(\n        FunctionCallContent(\n            id=bing_tool_call.id,\n            name=bing_tool_call.type,\n            function_name=bing_tool_call.type,\n            arguments=tool_details,\n        )\n    )\n    return message_content\n\n\n@experimental\ndef generate_azure_ai_search_content(\n    agent_name: str, azure_ai_search_tool_call: \"RunStepAzureAISearchToolCall\"\n) -> ChatMessageContent | None:\n    \"\"\"Generate function result content related to an Azure AI Search Tool.\"\"\"\n    items: list[FunctionCallContent | FunctionResultContent] = []","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/azure_ai/agent_content_generation.py#L293-L329","documentation":"Thrown by generate_bing_tool_result_content when the passed run-step tool call is neither RunStepBingGroundingToolCall nor RunStepBingCustomSearchToolCall. The function's type union only covers those two Azure AI Bing tool kinds, so any other RunStep tool-call subclass (or a future/new Bing tool type the SDK does not yet handle) hits the final else branch. This is effectively a defensive guard for an unexpected Azure SDK tool-call shape.","triggerScenarios":"Azure AI returns a run step with a Bing tool call variant the wrapper does not recognize (e.g. a new Bing tool type added in a newer azure-ai SDK), or a non-Bing tool call is routed into this function by mistake.","commonSituations":"Upgrading the azure-ai-agents SDK which introduces a new Bing tool subclass not yet handled by this version of semantic-kernel; misrouting a different tool-call type into the Bing content generator.","solutions":["Upgrade semantic-kernel to a version that handles the new Bing tool call type, or downgrade the azure-ai SDK to a compatible version.","Filter run steps so only RunStepBingGroundingToolCall / RunStepBingCustomSearchToolCall reach this function.","If you maintain a fork, extend the isinstance chain to cover the new type."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"from azure.ai.agents.models import RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall\nassert isinstance(bing_tool_call, (RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall))","typeGuard":"from azure.ai.agents.models import RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall\ndef is_supported_bing_tool_call(tc: object) -> bool:\n    return isinstance(tc, (RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall))","tryCatchPattern":"try:\n    content = generate_bing_tool_result_content(agent_name, bing_tool_call)\nexcept TypeError as e:\n    if 'Unsupported Bing tool call type' in str(e):\n        logger.warning('Skipping unsupported Bing tool call variant: %r', type(bing_tool_call))\n        content = None\n    else:\n        raise","preventionTips":["Filter run-step tool calls by type before dispatching to type-specific generators.","Keep semantic-kernel and azure-ai SDK versions aligned."],"tags":["azure-ai","bing","tool-call","type-guard","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}