From d312d67803fa83f1915569389a56ba20cf43b3c7 Mon Sep 17 00:00:00 2001 From: highbor <429335297@qq.com> Date: Sat, 27 Jun 2026 20:53:07 +0800 Subject: [PATCH] fix(openai/adapter): handle tool_search type to avoid empty tool name Codex sends tools with type "tool_search" but no name field. Previously this fell through to the default case and produced an empty tool name, which upstream providers (e.g. DeepSeek) reject. Assign the synthetic name "tool_search" like web_search/file_search. Fixes: Invalid 'tools[15].function.name': empty string --- internal/protocol/openai/adapter.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/protocol/openai/adapter.go b/internal/protocol/openai/adapter.go index 2dab9d1a..7ac64d73 100644 --- a/internal/protocol/openai/adapter.go +++ b/internal/protocol/openai/adapter.go @@ -1869,6 +1869,13 @@ func convertToolWithNamespace(tool Tool, namespace string, disablePatchProxy fun Description: "Search the web for up-to-date information.", Extensions: ext, }} + case "tool_search": + ext["source_type"] = tool.Type + return []format.CoreTool{{ + Name: tool.Type, + Description: "Search over deferred tool metadata and expose matching tools for the next model call.", + Extensions: ext, + }} case "file_search": ext["source_type"] = tool.Type ext["max_num_results"] = tool.MaxNumResults