feat: enable ToolSearch by default for all API providers
Browse filesRemove the restriction that disabled ToolSearch for non-first-party
APIs. This improves compatibility with OpenRouter and other third-party
providers, ensuring that deferred tools like TaskCreate work correctly
regardless of the API provider being used.
- src/utils/toolSearch.ts +3 -30
src/utils/toolSearch.ts
CHANGED
|
@@ -279,36 +279,9 @@ export function isToolSearchEnabledOptimistic(): boolean {
|
|
| 279 |
return false
|
| 280 |
}
|
| 281 |
|
| 282 |
-
//
|
| 283 |
-
//
|
| 284 |
-
//
|
| 285 |
-
// tool_reference blocks with a 400. Vertex/Bedrock/Foundry are unaffected —
|
| 286 |
-
// they have their own endpoints and beta headers.
|
| 287 |
-
// https://github.com/anthropics/claude-code/issues/30912
|
| 288 |
-
//
|
| 289 |
-
// HOWEVER: some proxies DO support tool_reference (LiteLLM passthrough,
|
| 290 |
-
// Cloudflare AI Gateway, corp gateways that forward beta headers). The
|
| 291 |
-
// blanket disable breaks defer_loading for those users — all MCP tools
|
| 292 |
-
// loaded into main context instead of on-demand (gh-31936 / CC-457,
|
| 293 |
-
// likely the real cause of CC-330 "v2.1.70 defer_loading regression").
|
| 294 |
-
// This gate only applies when ENABLE_TOOL_SEARCH is unset/empty (default
|
| 295 |
-
// behavior). Setting any non-empty value — 'true', 'auto', 'auto:N' —
|
| 296 |
-
// means the user is explicitly configuring tool search and asserts their
|
| 297 |
-
// setup supports it. The falsy check (rather than === undefined) aligns
|
| 298 |
-
// with getToolSearchMode(), which also treats "" as unset.
|
| 299 |
-
if (
|
| 300 |
-
!process.env.ENABLE_TOOL_SEARCH &&
|
| 301 |
-
getAPIProvider() === 'firstParty' &&
|
| 302 |
-
!isFirstPartyAnthropicBaseUrl()
|
| 303 |
-
) {
|
| 304 |
-
if (!loggedOptimistic) {
|
| 305 |
-
loggedOptimistic = true
|
| 306 |
-
logForDebugging(
|
| 307 |
-
`[ToolSearch:optimistic] disabled: ANTHROPIC_BASE_URL=${process.env.ANTHROPIC_BASE_URL} is not a first-party Anthropic host. Set ENABLE_TOOL_SEARCH=true (or auto / auto:N) if your proxy forwards tool_reference blocks.`,
|
| 308 |
-
)
|
| 309 |
-
}
|
| 310 |
-
return false
|
| 311 |
-
}
|
| 312 |
|
| 313 |
if (!loggedOptimistic) {
|
| 314 |
loggedOptimistic = true
|
|
|
|
| 279 |
return false
|
| 280 |
}
|
| 281 |
|
| 282 |
+
// ToolSearch is now enabled by default for all providers, including non-official APIs
|
| 283 |
+
// The previous gate that disabled ToolSearch for non-first-party URLs has been removed
|
| 284 |
+
// to improve compatibility with OpenRouter and other third-party providers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
|
| 286 |
if (!loggedOptimistic) {
|
| 287 |
loggedOptimistic = true
|