From 53fb75353f513b0c52c2066ed9baa7f909f007f9 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Wed, 17 Jun 2026 14:11:50 -0500 Subject: [PATCH] fix(chat): remove duplicate web_search tool in agentic_tools_all agentic_tools_literal() already contains a custom web_search tool. agentic_tools_with_web() adds the Anthropic server-side web_search_20250305 tool (also named web_search). Combining them caused Anthropic to reject every agentic request with 'Tool names must be unique.' agentic_tools_all() now calls agentic_tools_literal() directly. Connector tools splice in as before. The web_search-only variant (agentic_tools_with_web) is unchanged for callers that specifically want native search without connectors. --- chat.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chat.el b/chat.el index 5398c4e..f86ded9 100644 --- a/chat.el +++ b/chat.el @@ -317,10 +317,13 @@ fn connector_tools_json() -> String { return arr } -// Built-in tools + native web_search + every connector tool, as one tools array. -// Splices connector tools in before the closing bracket of the base array. +// Built-in tools + every connector tool, as one tools array. +// Uses agentic_tools_literal (not agentic_tools_with_web) to avoid a duplicate +// "web_search" name — the literal already includes a custom web_search handler, +// and adding the Anthropic server-side web_search_20250305 (same name) causes +// Anthropic to reject with "Tool names must be unique." fn agentic_tools_all() -> String { - let base: String = agentic_tools_with_web() + let base: String = agentic_tools_literal() let conn: String = connector_tools_json() let conn_inner: String = str_slice(conn, 1, str_len(conn) - 1) if str_eq(conn_inner, "") {