microsoft/semantic-kernel · error · NotSupportedException

Unable to create Azure AI tool definition because of unsuppo

Error message

Unable to create Azure AI tool definition because of unsupported tool type: {tool.Type}, supported tool types are: {string.Join(",", s_validToolTypes)}

What it means

Thrown by AzureAI AgentDefinitionExtensions.GetAzureToolDefinitions when an AgentToolDefinition.Type does not match any of the seven supported Azure AI tool types. The supported types are: azure_ai_search, azure_function, bing_grounding, code_interpreter, file_search, function, and openapi. The default case of the switch expression fires this NotSupportedException with the unsupported type and the list of valid types in the message.

Source

Thrown at dotnet/src/Agents/AzureAI/Extensions/AgentDefinitionExtensions.cs:61

    /// <param name="agentDefinition">Agent definition</param>
    /// <param name="kernel">Kernel instance to associate with the agent.</param>
    /// <exception cref="InvalidOperationException"></exception>
    public static IEnumerable<ToolDefinition> GetAzureToolDefinitions(this AgentDefinition agentDefinition, Kernel kernel)
    {
        Verify.NotNull(agentDefinition);

        return agentDefinition.Tools?.Select<AgentToolDefinition, ToolDefinition>(tool =>
        {
            return tool.Type switch
            {
                AzureAISearchType => CreateAzureAISearchToolDefinition(tool),
                AzureFunctionType => CreateAzureFunctionToolDefinition(tool),
                BingGroundingType => CreateBingGroundingToolDefinition(tool, agentDefinition.GetProjectsClient(kernel)),
                CodeInterpreterType => CreateCodeInterpreterToolDefinition(tool),
                FileSearchType => CreateFileSearchToolDefinition(tool),
                FunctionType => CreateFunctionToolDefinition(tool),
                OpenApiType => CreateOpenApiToolDefinition(tool),
                _ => throw new NotSupportedException($"Unable to create Azure AI tool definition because of unsupported tool type: {tool.Type}, supported tool types are: {string.Join(",", s_validToolTypes)}"),
            };
        }) ?? [];
    }

    /// <summary>
    /// Return the Azure AI tool resources which corresponds with the provided <see cref="AgentDefinition"/>.
    /// </summary>
    /// <param name="agentDefinition">Agent definition</param>
    public static ToolResources GetAzureToolResources(this AgentDefinition agentDefinition)
    {
        Verify.NotNull(agentDefinition);

        var toolResources = new ToolResources();

        var codeInterpreter = agentDefinition.GetCodeInterpreterToolResource();
        if (codeInterpreter is not null)
        {
            toolResources.CodeInterpreter = codeInterpreter;

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Check the error message which lists all supported types and fix the tool Type to one of them.
  2. Use underscores not hyphens: e.g., 'code_interpreter' not 'code-interpreter'.
  3. Verify the agent definition is intended for Azure AI agents, not another agent type.
  4. If using a genuinely new tool type, check for an updated SDK version that adds support.

Example fix

// before — definition has "type": "code-interpreter"
// after — definition has "type": "code_interpreter"
Defensive patterns

Strategy: validation

Validate before calling

var validTypes = new HashSet<string>(StringComparer.Ordinal)
{
    "azure_ai_search", "azure_function", "bing_grounding",
    "code_interpreter", "file_search", "function", "openapi"
};
var invalid = definition.Tools?.Where(t => !validTypes.Contains(t.Type)).ToList();
if (invalid?.Count > 0)
{
    throw new ArgumentException(
        $"Unsupported tool types: {string.Join(", ", invalid.Select(t => t.Type))}");
}

Try / catch

try
{
    var tools = definition.GetAzureToolDefinitions(kernel);
}
catch (NotSupportedException ex)
{
    _logger.LogError("Unsupported Azure AI tool type: {Message}", ex.Message);
    throw;
}

Prevention

When it happens

Trigger: An agent definition specifies a tool with a Type string that is not one of the seven recognized Azure AI tool type constants. For example, a typo like "code-interpreter" (hyphen instead of underscore), a tool type from another platform (e.g., "openai_retrieval"), or a custom tool type not yet supported.

Common situations: Typo in tool type in the agent definition file. Using a tool type valid for OpenAI Assistant but not for Azure AI (or vice versa). Definition written for a different agent platform. SDK version that doesn't yet support a newer tool type. Case sensitivity issues (types are matched exactly).

Related errors


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