{"record":{"id":"9a840683da4078b0","repo":"microsoft/semantic-kernel","slug":"unsupported-tool-type-spec-type-9a8406","errorCode":null,"errorMessage":"Unsupported tool type: {spec.type}","messagePattern":"Unsupported tool type: (.+?)","errorType":"exception","errorClass":"AgentInitializationException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/open_ai/openai_assistant_agent.py","lineNumber":126,"sourceCode":"\n\n# Update _file_search\n@_register_tool(\"file_search\")\ndef _file_search(spec: ToolSpec, kernel: Kernel | None = None) -> tuple[list[AssistantToolParam], ToolResources]:\n    vector_store_ids = spec.options.get(\"vector_store_ids\")\n    if not vector_store_ids or not isinstance(vector_store_ids, list) or not vector_store_ids[0]:\n        raise AgentInitializationException(f\"Missing or malformed 'vector_store_ids' in: {spec}\")\n    return OpenAIAssistantAgent.configure_file_search_tool(vector_store_ids=vector_store_ids)\n\n\ndef _build_tool(spec: ToolSpec, kernel: \"Kernel\") -> tuple[list[AssistantToolParam], ToolResources]:\n    if not spec.type:\n        raise AgentInitializationException(\"Tool spec must include a 'type' field.\")\n\n    try:\n        builder = _TOOL_BUILDERS[spec.type.lower()]\n    except KeyError as exc:\n        raise AgentInitializationException(f\"Unsupported tool type: {spec.type}\") from exc\n\n    sig = inspect.signature(builder)\n    return builder(spec) if len(sig.parameters) == 1 else builder(spec, kernel)  # type: ignore[call-arg]\n\n\n# endregion\n\n\n@release_candidate\nclass AssistantAgentThread(AgentThread):\n    \"\"\"An OpenAI Assistant Agent Thread class.\"\"\"\n\n    def __init__(\n        self,\n        client: AsyncOpenAI,\n        thread_id: str | None = None,\n        messages: Iterable[\"ThreadCreateMessage\"] | Omit = omit,\n        metadata: dict[str, Any] | Omit = omit,","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/open_ai/openai_assistant_agent.py#L108-L144","documentation":"Raised by _build_tool when spec.type.lower() is not a registered tool type. Only builders registered via @_register_tool exist (currently 'code_interpreter' and 'file_search'); any other type produces a KeyError that is wrapped in this AgentInitializationException.","triggerScenarios":"Setting ToolSpec.type to a value not in the registry, e.g. 'function', 'retrieval', 'web_search', or a typo like 'file_serch'. Case-insensitive (the lookup lowercases), so the issue is the value itself.","commonSituations":"Assisting function-calling tools are configured as assistant tools here (they are not; functions are registered on the kernel instead); using legacy OpenAI type names ('retrieval'); typos; expecting a tool type not yet supported by this declarative layer.","solutions":["Use only registered tool types: 'code_interpreter' or 'file_search'.","For function/plugin tools, register them on the Kernel instead of as an assistant tool spec.","Fix typos in the type string.","If you need a custom tool type, register a builder with @_register_tool('your_type') before building."],"exampleFix":"# before\ntool = ToolSpec(type=\"retrieval\", options={...})  # unsupported\n# after\ntool = ToolSpec(type=\"file_search\", options={\"vector_store_ids\": [\"vs_1\"]})","handlingStrategy":"validation","validationCode":"SUPPORTED_TOOL_TYPES = {\"code_interpreter\", \"file_search\"}\nif spec.type and spec.type.lower() not in SUPPORTED_TOOL_TYPES:\n    raise ValueError(\n        f\"Unsupported assistant tool type '{spec.type}'. \"\n        f\"Supported: {sorted(SUPPORTED_TOOL_TYPES)}. Use the Kernel for function/plugin tools.\"\n    )","typeGuard":"def is_supported_tool_type(t) -> bool:\n    return isinstance(t, str) and t.lower() in {\"code_interpreter\", \"file_search\"}","tryCatchPattern":null,"preventionTips":["Register function/plugin tools on the Kernel, not as assistant tool specs.","Restrict declarative tool 'type' values to code_interpreter/file_search.","Register custom builders via @_register_tool before use if you extend the set."],"tags":["openai","semantic-kernel","agents","tools","declarative-spec","validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}