microsoft/semantic-kernel · error · TypeError

Unsupported Bing tool call type: {type(bing_tool_call)}

Error message

Unsupported Bing tool call type: {type(bing_tool_call)}

What it means

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.

Source

Thrown at python/semantic_kernel/agents/azure_ai/agent_content_generation.py:311

    )
    return function_call_content


@experimental
def generate_bing_grounding_content(
    agent_name: str, bing_tool_call: "RunStepBingGroundingToolCall | RunStepBingCustomSearchToolCall"
) -> ChatMessageContent:
    """Generate function result content related to a Bing Grounding Tool or Bing Custom Search Tool."""
    message_content: ChatMessageContent = ChatMessageContent(role=AuthorRole.ASSISTANT, name=agent_name)  # type: ignore

    # Extract tool details based on the specific tool type
    if isinstance(bing_tool_call, RunStepBingGroundingToolCall):
        tool_details = bing_tool_call.bing_grounding
    elif isinstance(bing_tool_call, RunStepBingCustomSearchToolCall):
        tool_details = bing_tool_call.bing_custom_search
    else:
        # This should never happen with proper typing, but provides safety
        raise TypeError(f"Unsupported Bing tool call type: {type(bing_tool_call)}")

    message_content.items.append(
        FunctionCallContent(
            id=bing_tool_call.id,
            name=bing_tool_call.type,
            function_name=bing_tool_call.type,
            arguments=tool_details,
        )
    )
    return message_content


@experimental
def generate_azure_ai_search_content(
    agent_name: str, azure_ai_search_tool_call: "RunStepAzureAISearchToolCall"
) -> ChatMessageContent | None:
    """Generate function result content related to an Azure AI Search Tool."""
    items: list[FunctionCallContent | FunctionResultContent] = []

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Upgrade semantic-kernel to a version that handles the new Bing tool call type, or downgrade the azure-ai SDK to a compatible version.
  2. Filter run steps so only RunStepBingGroundingToolCall / RunStepBingCustomSearchToolCall reach this function.
  3. If you maintain a fork, extend the isinstance chain to cover the new type.
Defensive patterns

Strategy: type-guard

Validate before calling

from azure.ai.agents.models import RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall
assert isinstance(bing_tool_call, (RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall))

Type guard

from azure.ai.agents.models import RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall
def is_supported_bing_tool_call(tc: object) -> bool:
    return isinstance(tc, (RunStepBingGroundingToolCall, RunStepBingCustomSearchToolCall))

Try / catch

try:
    content = generate_bing_tool_result_content(agent_name, bing_tool_call)
except TypeError as e:
    if 'Unsupported Bing tool call type' in str(e):
        logger.warning('Skipping unsupported Bing tool call variant: %r', type(bing_tool_call))
        content = None
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/e5e870a34c111611. Report an issue: GitHub.