{"record":{"id":"58734069ee715abf","repo":"openai/openai-python","slug":"currently-only-function-tool-types-support-auto","errorCode":null,"errorMessage":"Currently only `function` tool types support auto-parsing; Received `{tool['type']}`","messagePattern":"Currently only `function` tool types support auto-parsing; Received `(.+?)`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/openai/lib/_parsing/_completions.py","lineNumber":73,"sourceCode":"def select_strict_chat_completion_tools(\n    tools: Iterable[ChatCompletionToolUnionParam] | Omit = omit,\n) -> Iterable[ChatCompletionFunctionToolParam] | Omit:\n    \"\"\"Select only the strict ChatCompletionFunctionToolParams from the given tools.\"\"\"\n    if not is_given(tools):\n        return omit\n\n    return [t for t in tools if is_strict_chat_completion_tool_param(t)]\n\n\ndef validate_input_tools(\n    tools: Iterable[ChatCompletionToolUnionParam] | Omit = omit,\n) -> Iterable[ChatCompletionFunctionToolParam] | Omit:\n    if not is_given(tools):\n        return omit\n\n    for tool in tools:\n        if tool[\"type\"] != \"function\":\n            raise ValueError(\n                f\"Currently only `function` tool types support auto-parsing; Received `{tool['type']}`\",\n            )\n\n        strict = tool[\"function\"].get(\"strict\")\n        if strict is not True:\n            raise ValueError(\n                f\"`{tool['function']['name']}` is not strict. Only `strict` function tools can be auto-parsed\"\n            )\n\n    return cast(Iterable[ChatCompletionFunctionToolParam], tools)\n\n\ndef parse_chat_completion(\n    *,\n    response_format: type[ResponseFormatT] | completion_create_params.ResponseFormat | Omit,\n    input_tools: Iterable[ChatCompletionToolUnionParam] | Omit,\n    chat_completion: ChatCompletion | ParsedChatCompletion[object],\n) -> ParsedChatCompletion[ResponseFormatT]:","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/lib/_parsing/_completions.py#L55-L91","documentation":"The completions auto-parsing helpers (chat.completions.parse / maybe_parse_content) only support tools of type 'function'; the model's structured-output parsing cannot auto-parse other tool types like 'custom' or code-interpreter tools. The library validates tools before sending the request.","triggerScenarios":"Passing a tools=[{'type': 'custom', ...}] (or any non-'function' type) to client.chat.completions.parse.","commonSituations":"Reusing a tool list built for regular completions.create with .parse(); migrating code to .parse() while keeping freeform/custom tools; copying tool JSON from newer API docs.","solutions":["Remove non-function tools when using .parse() and auto-parsing","Split the request: use .parse() for strict function tools and completions.create for other tool types","Implement a custom tool loop manually if you need custom tools with parsing"],"exampleFix":"# before\nclient.chat.completions.parse(model=..., tools=[{\"type\":\"custom\",\"custom\":{...}}], ...)\n# after\nclient.chat.completions.parse(model=..., tools=[{\"type\":\"function\",\"function\":{...}}], ...)","handlingStrategy":"validation","validationCode":"bad = [t for t in tools if t.get(\"type\") != \"function\"]\nassert not bad, f\"non-function tools not supported by .parse(): {bad}\"","typeGuard":"def is_function_tool(t: dict) -> bool:\n    return t.get(\"type\") == \"function\"","tryCatchPattern":null,"preventionTips":["Keep separate tool lists for .parse() vs .create()","Validate tool types before calling .parse()"],"tags":["completions","tools","validation","parsing"],"backgroundTag":"unsupported-tool-type","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}