@ai-sdk/anthropic 3.0.0-beta.74 → 3.0.0-beta.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(internal_exports);
28
28
 
29
29
  // src/anthropic-messages-language-model.ts
30
30
  var import_provider3 = require("@ai-sdk/provider");
31
- var import_provider_utils11 = require("@ai-sdk/provider-utils");
31
+ var import_provider_utils12 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/anthropic-error.ts
34
34
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -246,6 +246,26 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
246
246
  old_start: import_v42.z.number().nullable()
247
247
  })
248
248
  ])
249
+ }),
250
+ // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
251
+ import_v42.z.object({
252
+ type: import_v42.z.literal("tool_search_tool_result"),
253
+ tool_use_id: import_v42.z.string(),
254
+ content: import_v42.z.union([
255
+ import_v42.z.object({
256
+ type: import_v42.z.literal("tool_search_tool_search_result"),
257
+ tool_references: import_v42.z.array(
258
+ import_v42.z.object({
259
+ type: import_v42.z.literal("tool_reference"),
260
+ tool_name: import_v42.z.string()
261
+ })
262
+ )
263
+ }),
264
+ import_v42.z.object({
265
+ type: import_v42.z.literal("tool_search_tool_result_error"),
266
+ error_code: import_v42.z.string()
267
+ })
268
+ ])
249
269
  })
250
270
  ])
251
271
  ),
@@ -447,6 +467,26 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
447
467
  old_start: import_v42.z.number().nullable()
448
468
  })
449
469
  ])
470
+ }),
471
+ // tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
472
+ import_v42.z.object({
473
+ type: import_v42.z.literal("tool_search_tool_result"),
474
+ tool_use_id: import_v42.z.string(),
475
+ content: import_v42.z.union([
476
+ import_v42.z.object({
477
+ type: import_v42.z.literal("tool_search_tool_search_result"),
478
+ tool_references: import_v42.z.array(
479
+ import_v42.z.object({
480
+ type: import_v42.z.literal("tool_reference"),
481
+ tool_name: import_v42.z.string()
482
+ })
483
+ )
484
+ }),
485
+ import_v42.z.object({
486
+ type: import_v42.z.literal("tool_search_tool_result_error"),
487
+ error_code: import_v42.z.string()
488
+ })
489
+ ])
450
490
  })
451
491
  ])
452
492
  }),
@@ -852,6 +892,7 @@ async function prepareTools({
852
892
  cacheControlValidator,
853
893
  supportsStructuredOutput
854
894
  }) {
895
+ var _a;
855
896
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
856
897
  const toolWarnings = [];
857
898
  const betas = /* @__PURE__ */ new Set();
@@ -867,12 +908,15 @@ async function prepareTools({
867
908
  type: "tool definition",
868
909
  canCache: true
869
910
  });
911
+ const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
912
+ const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
870
913
  anthropicTools2.push({
871
914
  name: tool.name,
872
915
  description: tool.description,
873
916
  input_schema: tool.inputSchema,
874
917
  cache_control: cacheControl,
875
918
  ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
919
+ ...deferLoading != null ? { defer_loading: deferLoading } : {},
876
920
  ...tool.inputExamples != null ? {
877
921
  input_examples: tool.inputExamples.map(
878
922
  (example) => example.input
@@ -1027,6 +1071,22 @@ async function prepareTools({
1027
1071
  });
1028
1072
  break;
1029
1073
  }
1074
+ case "anthropic.tool_search_regex_20251119": {
1075
+ betas.add("advanced-tool-use-2025-11-20");
1076
+ anthropicTools2.push({
1077
+ type: "tool_search_tool_regex_20251119",
1078
+ name: "tool_search_tool_regex"
1079
+ });
1080
+ break;
1081
+ }
1082
+ case "anthropic.tool_search_bm25_20251119": {
1083
+ betas.add("advanced-tool-use-2025-11-20");
1084
+ anthropicTools2.push({
1085
+ type: "tool_search_tool_bm25_20251119",
1086
+ name: "tool_search_tool_bm25"
1087
+ });
1088
+ break;
1089
+ }
1030
1090
  default: {
1031
1091
  toolWarnings.push({
1032
1092
  type: "unsupported",
@@ -1100,7 +1160,7 @@ async function prepareTools({
1100
1160
 
1101
1161
  // src/convert-to-anthropic-messages-prompt.ts
1102
1162
  var import_provider2 = require("@ai-sdk/provider");
1103
- var import_provider_utils10 = require("@ai-sdk/provider-utils");
1163
+ var import_provider_utils11 = require("@ai-sdk/provider-utils");
1104
1164
 
1105
1165
  // src/tool/code-execution_20250522.ts
1106
1166
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
@@ -1219,6 +1279,49 @@ var codeExecution_20250825 = (args = {}) => {
1219
1279
  return factory5(args);
1220
1280
  };
1221
1281
 
1282
+ // src/tool/tool-search-regex_20251119.ts
1283
+ var import_provider_utils10 = require("@ai-sdk/provider-utils");
1284
+ var import_v49 = require("zod/v4");
1285
+ var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils10.lazySchema)(
1286
+ () => (0, import_provider_utils10.zodSchema)(
1287
+ import_v49.z.array(
1288
+ import_v49.z.object({
1289
+ type: import_v49.z.literal("tool_reference"),
1290
+ toolName: import_v49.z.string()
1291
+ })
1292
+ )
1293
+ )
1294
+ );
1295
+ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils10.lazySchema)(
1296
+ () => (0, import_provider_utils10.zodSchema)(
1297
+ import_v49.z.object({
1298
+ /**
1299
+ * A regex pattern to search for tools.
1300
+ * Uses Python re.search() syntax. Maximum 200 characters.
1301
+ *
1302
+ * Examples:
1303
+ * - "weather" - matches tool names/descriptions containing "weather"
1304
+ * - "get_.*_data" - matches tools like get_user_data, get_weather_data
1305
+ * - "database.*query|query.*database" - OR patterns for flexibility
1306
+ * - "(?i)slack" - case-insensitive search
1307
+ */
1308
+ pattern: import_v49.z.string(),
1309
+ /**
1310
+ * Maximum number of tools to return. Optional.
1311
+ */
1312
+ limit: import_v49.z.number().optional()
1313
+ })
1314
+ )
1315
+ );
1316
+ var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
1317
+ id: "anthropic.tool_search_regex_20251119",
1318
+ inputSchema: toolSearchRegex_20251119InputSchema,
1319
+ outputSchema: toolSearchRegex_20251119OutputSchema
1320
+ });
1321
+ var toolSearchRegex_20251119 = (args = {}) => {
1322
+ return factory6(args);
1323
+ };
1324
+
1222
1325
  // src/convert-to-anthropic-messages-prompt.ts
1223
1326
  function convertToString(data) {
1224
1327
  if (typeof data === "string") {
@@ -1251,7 +1354,7 @@ async function convertToAnthropicMessagesPrompt({
1251
1354
  const messages = [];
1252
1355
  async function shouldEnableCitations(providerMetadata) {
1253
1356
  var _a2, _b2;
1254
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1357
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
1255
1358
  provider: "anthropic",
1256
1359
  providerOptions: providerMetadata,
1257
1360
  schema: anthropicFilePartProviderOptions
@@ -1259,7 +1362,7 @@ async function convertToAnthropicMessagesPrompt({
1259
1362
  return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
1260
1363
  }
1261
1364
  async function getDocumentMetadata(providerMetadata) {
1262
- const anthropicOptions = await (0, import_provider_utils10.parseProviderOptions)({
1365
+ const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
1263
1366
  provider: "anthropic",
1264
1367
  providerOptions: providerMetadata,
1265
1368
  schema: anthropicFilePartProviderOptions
@@ -1325,7 +1428,7 @@ async function convertToAnthropicMessagesPrompt({
1325
1428
  } : {
1326
1429
  type: "base64",
1327
1430
  media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
1328
- data: (0, import_provider_utils10.convertToBase64)(part.data)
1431
+ data: (0, import_provider_utils11.convertToBase64)(part.data)
1329
1432
  },
1330
1433
  cache_control: cacheControl
1331
1434
  });
@@ -1345,7 +1448,7 @@ async function convertToAnthropicMessagesPrompt({
1345
1448
  } : {
1346
1449
  type: "base64",
1347
1450
  media_type: "application/pdf",
1348
- data: (0, import_provider_utils10.convertToBase64)(part.data)
1451
+ data: (0, import_provider_utils11.convertToBase64)(part.data)
1349
1452
  },
1350
1453
  title: (_b = metadata.title) != null ? _b : part.filename,
1351
1454
  ...metadata.context && { context: metadata.context },
@@ -1465,7 +1568,7 @@ async function convertToAnthropicMessagesPrompt({
1465
1568
  return void 0;
1466
1569
  }
1467
1570
  }
1468
- }).filter(import_provider_utils10.isNonNullable);
1571
+ }).filter(import_provider_utils11.isNonNullable);
1469
1572
  break;
1470
1573
  case "text":
1471
1574
  case "error-text":
@@ -1532,7 +1635,7 @@ async function convertToAnthropicMessagesPrompt({
1532
1635
  }
1533
1636
  case "reasoning": {
1534
1637
  if (sendReasoning) {
1535
- const reasoningMetadata = await (0, import_provider_utils10.parseProviderOptions)({
1638
+ const reasoningMetadata = await (0, import_provider_utils11.parseProviderOptions)({
1536
1639
  provider: "anthropic",
1537
1640
  providerOptions: part.providerOptions,
1538
1641
  schema: anthropicReasoningMetadataSchema
@@ -1623,6 +1726,14 @@ async function convertToAnthropicMessagesPrompt({
1623
1726
  input: part.input,
1624
1727
  cache_control: cacheControl
1625
1728
  });
1729
+ } else if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
1730
+ anthropicContent.push({
1731
+ type: "server_tool_use",
1732
+ id: part.toolCallId,
1733
+ name: providerToolName,
1734
+ input: part.input,
1735
+ cache_control: cacheControl
1736
+ });
1626
1737
  } else {
1627
1738
  warnings.push({
1628
1739
  type: "other",
@@ -1678,7 +1789,7 @@ async function convertToAnthropicMessagesPrompt({
1678
1789
  break;
1679
1790
  }
1680
1791
  if (output.value.type === "code_execution_result") {
1681
- const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
1792
+ const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
1682
1793
  value: output.value,
1683
1794
  schema: codeExecution_20250522OutputSchema
1684
1795
  });
@@ -1694,7 +1805,7 @@ async function convertToAnthropicMessagesPrompt({
1694
1805
  cache_control: cacheControl
1695
1806
  });
1696
1807
  } else {
1697
- const codeExecutionOutput = await (0, import_provider_utils10.validateTypes)({
1808
+ const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
1698
1809
  value: output.value,
1699
1810
  schema: codeExecution_20250825OutputSchema
1700
1811
  });
@@ -1723,7 +1834,7 @@ async function convertToAnthropicMessagesPrompt({
1723
1834
  });
1724
1835
  break;
1725
1836
  }
1726
- const webFetchOutput = await (0, import_provider_utils10.validateTypes)({
1837
+ const webFetchOutput = await (0, import_provider_utils11.validateTypes)({
1727
1838
  value: output.value,
1728
1839
  schema: webFetch_20250910OutputSchema
1729
1840
  });
@@ -1758,7 +1869,7 @@ async function convertToAnthropicMessagesPrompt({
1758
1869
  });
1759
1870
  break;
1760
1871
  }
1761
- const webSearchOutput = await (0, import_provider_utils10.validateTypes)({
1872
+ const webSearchOutput = await (0, import_provider_utils11.validateTypes)({
1762
1873
  value: output.value,
1763
1874
  schema: webSearch_20250305OutputSchema
1764
1875
  });
@@ -1776,6 +1887,34 @@ async function convertToAnthropicMessagesPrompt({
1776
1887
  });
1777
1888
  break;
1778
1889
  }
1890
+ if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
1891
+ const output = part.output;
1892
+ if (output.type !== "json") {
1893
+ warnings.push({
1894
+ type: "other",
1895
+ message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
1896
+ });
1897
+ break;
1898
+ }
1899
+ const toolSearchOutput = await (0, import_provider_utils11.validateTypes)({
1900
+ value: output.value,
1901
+ schema: toolSearchRegex_20251119OutputSchema
1902
+ });
1903
+ const toolReferences = toolSearchOutput.map((ref) => ({
1904
+ type: "tool_reference",
1905
+ tool_name: ref.toolName
1906
+ }));
1907
+ anthropicContent.push({
1908
+ type: "tool_search_tool_result",
1909
+ tool_use_id: part.toolCallId,
1910
+ content: {
1911
+ type: "tool_search_tool_search_result",
1912
+ tool_references: toolReferences
1913
+ },
1914
+ cache_control: cacheControl
1915
+ });
1916
+ break;
1917
+ }
1779
1918
  warnings.push({
1780
1919
  type: "other",
1781
1920
  message: `provider executed tool result for tool ${part.toolName} is not supported`
@@ -1903,7 +2042,7 @@ var AnthropicMessagesLanguageModel = class {
1903
2042
  var _a;
1904
2043
  this.modelId = modelId;
1905
2044
  this.config = config;
1906
- this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils11.generateId;
2045
+ this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils12.generateId;
1907
2046
  }
1908
2047
  supportsUrl(url) {
1909
2048
  return url.protocol === "https:";
@@ -1967,7 +2106,7 @@ var AnthropicMessagesLanguageModel = class {
1967
2106
  });
1968
2107
  }
1969
2108
  }
1970
- const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
2109
+ const anthropicOptions = await (0, import_provider_utils12.parseProviderOptions)({
1971
2110
  provider: "anthropic",
1972
2111
  providerOptions,
1973
2112
  schema: anthropicProviderOptions
@@ -1986,7 +2125,7 @@ var AnthropicMessagesLanguageModel = class {
1986
2125
  inputSchema: responseFormat.schema
1987
2126
  } : void 0;
1988
2127
  const cacheControlValidator = new CacheControlValidator();
1989
- const toolNameMapping = (0, import_provider_utils11.createToolNameMapping)({
2128
+ const toolNameMapping = (0, import_provider_utils12.createToolNameMapping)({
1990
2129
  tools,
1991
2130
  providerToolNames: {
1992
2131
  "anthropic.code_execution_20250522": "code_execution",
@@ -2001,7 +2140,9 @@ var AnthropicMessagesLanguageModel = class {
2001
2140
  "anthropic.bash_20250124": "bash",
2002
2141
  "anthropic.memory_20250818": "memory",
2003
2142
  "anthropic.web_search_20250305": "web_search",
2004
- "anthropic.web_fetch_20250910": "web_fetch"
2143
+ "anthropic.web_fetch_20250910": "web_fetch",
2144
+ "anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
2145
+ "anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
2005
2146
  }
2006
2147
  });
2007
2148
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
@@ -2171,15 +2312,15 @@ var AnthropicMessagesLanguageModel = class {
2171
2312
  betas,
2172
2313
  headers
2173
2314
  }) {
2174
- return (0, import_provider_utils11.combineHeaders)(
2175
- await (0, import_provider_utils11.resolve)(this.config.headers),
2315
+ return (0, import_provider_utils12.combineHeaders)(
2316
+ await (0, import_provider_utils12.resolve)(this.config.headers),
2176
2317
  headers,
2177
2318
  betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
2178
2319
  );
2179
2320
  }
2180
2321
  async getBetasFromHeaders(requestHeaders) {
2181
2322
  var _a, _b;
2182
- const configHeaders = await (0, import_provider_utils11.resolve)(this.config.headers);
2323
+ const configHeaders = await (0, import_provider_utils12.resolve)(this.config.headers);
2183
2324
  const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
2184
2325
  const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
2185
2326
  return new Set(
@@ -2232,12 +2373,12 @@ var AnthropicMessagesLanguageModel = class {
2232
2373
  responseHeaders,
2233
2374
  value: response,
2234
2375
  rawValue: rawResponse
2235
- } = await (0, import_provider_utils11.postJsonToApi)({
2376
+ } = await (0, import_provider_utils12.postJsonToApi)({
2236
2377
  url: this.buildRequestUrl(false),
2237
2378
  headers: await this.getHeaders({ betas, headers: options.headers }),
2238
2379
  body: this.transformRequestBody(args),
2239
2380
  failedResponseHandler: anthropicFailedResponseHandler,
2240
- successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
2381
+ successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
2241
2382
  anthropicMessagesResponseSchema
2242
2383
  ),
2243
2384
  abortSignal: options.abortSignal,
@@ -2325,6 +2466,14 @@ var AnthropicMessagesLanguageModel = class {
2325
2466
  input: JSON.stringify(part.input),
2326
2467
  providerExecuted: true
2327
2468
  });
2469
+ } else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
2470
+ content.push({
2471
+ type: "tool-call",
2472
+ toolCallId: part.id,
2473
+ toolName: toolNameMapping.toCustomToolName(part.name),
2474
+ input: JSON.stringify(part.input),
2475
+ providerExecuted: true
2476
+ });
2328
2477
  }
2329
2478
  break;
2330
2479
  }
@@ -2478,6 +2627,32 @@ var AnthropicMessagesLanguageModel = class {
2478
2627
  });
2479
2628
  break;
2480
2629
  }
2630
+ // tool search tool results:
2631
+ case "tool_search_tool_result": {
2632
+ if (part.content.type === "tool_search_tool_search_result") {
2633
+ content.push({
2634
+ type: "tool-result",
2635
+ toolCallId: part.tool_use_id,
2636
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
2637
+ result: part.content.tool_references.map((ref) => ({
2638
+ type: ref.type,
2639
+ toolName: ref.tool_name
2640
+ }))
2641
+ });
2642
+ } else {
2643
+ content.push({
2644
+ type: "tool-result",
2645
+ toolCallId: part.tool_use_id,
2646
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
2647
+ isError: true,
2648
+ result: {
2649
+ type: "tool_search_tool_result_error",
2650
+ errorCode: part.content.error_code
2651
+ }
2652
+ });
2653
+ }
2654
+ break;
2655
+ }
2481
2656
  }
2482
2657
  }
2483
2658
  return {
@@ -2533,12 +2708,12 @@ var AnthropicMessagesLanguageModel = class {
2533
2708
  });
2534
2709
  const citationDocuments = this.extractCitationDocuments(options.prompt);
2535
2710
  const url = this.buildRequestUrl(true);
2536
- const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
2711
+ const { responseHeaders, value: response } = await (0, import_provider_utils12.postJsonToApi)({
2537
2712
  url,
2538
2713
  headers: await this.getHeaders({ betas, headers: options.headers }),
2539
2714
  body: this.transformRequestBody(body),
2540
2715
  failedResponseHandler: anthropicFailedResponseHandler,
2541
- successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
2716
+ successfulResponseHandler: (0, import_provider_utils12.createEventSourceResponseHandler)(
2542
2717
  anthropicMessagesChunkSchema
2543
2718
  ),
2544
2719
  abortSignal: options.abortSignal,
@@ -2668,6 +2843,25 @@ var AnthropicMessagesLanguageModel = class {
2668
2843
  toolName: customToolName,
2669
2844
  providerExecuted: true
2670
2845
  });
2846
+ } else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
2847
+ const customToolName = toolNameMapping.toCustomToolName(
2848
+ part.name
2849
+ );
2850
+ contentBlocks[value.index] = {
2851
+ type: "tool-call",
2852
+ toolCallId: part.id,
2853
+ toolName: customToolName,
2854
+ input: "",
2855
+ providerExecuted: true,
2856
+ firstDelta: true,
2857
+ providerToolName: part.name
2858
+ };
2859
+ controller.enqueue({
2860
+ type: "tool-input-start",
2861
+ id: part.id,
2862
+ toolName: customToolName,
2863
+ providerExecuted: true
2864
+ });
2671
2865
  }
2672
2866
  return;
2673
2867
  }
@@ -2791,6 +2985,32 @@ var AnthropicMessagesLanguageModel = class {
2791
2985
  });
2792
2986
  return;
2793
2987
  }
2988
+ // tool search tool results:
2989
+ case "tool_search_tool_result": {
2990
+ if (part.content.type === "tool_search_tool_search_result") {
2991
+ controller.enqueue({
2992
+ type: "tool-result",
2993
+ toolCallId: part.tool_use_id,
2994
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
2995
+ result: part.content.tool_references.map((ref) => ({
2996
+ type: ref.type,
2997
+ toolName: ref.tool_name
2998
+ }))
2999
+ });
3000
+ } else {
3001
+ controller.enqueue({
3002
+ type: "tool-result",
3003
+ toolCallId: part.tool_use_id,
3004
+ toolName: toolNameMapping.toCustomToolName("tool_search"),
3005
+ isError: true,
3006
+ result: {
3007
+ type: "tool_search_tool_result_error",
3008
+ errorCode: part.content.error_code
3009
+ }
3010
+ });
3011
+ }
3012
+ return;
3013
+ }
2794
3014
  case "mcp_tool_use": {
2795
3015
  mcpToolCalls[part.id] = {
2796
3016
  type: "tool-call",
@@ -3102,44 +3322,44 @@ function getModelCapabilities(modelId) {
3102
3322
  }
3103
3323
 
3104
3324
  // src/tool/bash_20241022.ts
3105
- var import_provider_utils12 = require("@ai-sdk/provider-utils");
3106
- var import_v49 = require("zod/v4");
3107
- var bash_20241022InputSchema = (0, import_provider_utils12.lazySchema)(
3108
- () => (0, import_provider_utils12.zodSchema)(
3109
- import_v49.z.object({
3110
- command: import_v49.z.string(),
3111
- restart: import_v49.z.boolean().optional()
3325
+ var import_provider_utils13 = require("@ai-sdk/provider-utils");
3326
+ var import_v410 = require("zod/v4");
3327
+ var bash_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
3328
+ () => (0, import_provider_utils13.zodSchema)(
3329
+ import_v410.z.object({
3330
+ command: import_v410.z.string(),
3331
+ restart: import_v410.z.boolean().optional()
3112
3332
  })
3113
3333
  )
3114
3334
  );
3115
- var bash_20241022 = (0, import_provider_utils12.createProviderToolFactory)({
3335
+ var bash_20241022 = (0, import_provider_utils13.createProviderToolFactory)({
3116
3336
  id: "anthropic.bash_20241022",
3117
3337
  inputSchema: bash_20241022InputSchema
3118
3338
  });
3119
3339
 
3120
3340
  // src/tool/bash_20250124.ts
3121
- var import_provider_utils13 = require("@ai-sdk/provider-utils");
3122
- var import_v410 = require("zod/v4");
3123
- var bash_20250124InputSchema = (0, import_provider_utils13.lazySchema)(
3124
- () => (0, import_provider_utils13.zodSchema)(
3125
- import_v410.z.object({
3126
- command: import_v410.z.string(),
3127
- restart: import_v410.z.boolean().optional()
3341
+ var import_provider_utils14 = require("@ai-sdk/provider-utils");
3342
+ var import_v411 = require("zod/v4");
3343
+ var bash_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
3344
+ () => (0, import_provider_utils14.zodSchema)(
3345
+ import_v411.z.object({
3346
+ command: import_v411.z.string(),
3347
+ restart: import_v411.z.boolean().optional()
3128
3348
  })
3129
3349
  )
3130
3350
  );
3131
- var bash_20250124 = (0, import_provider_utils13.createProviderToolFactory)({
3351
+ var bash_20250124 = (0, import_provider_utils14.createProviderToolFactory)({
3132
3352
  id: "anthropic.bash_20250124",
3133
3353
  inputSchema: bash_20250124InputSchema
3134
3354
  });
3135
3355
 
3136
3356
  // src/tool/computer_20241022.ts
3137
- var import_provider_utils14 = require("@ai-sdk/provider-utils");
3138
- var import_v411 = require("zod/v4");
3139
- var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
3140
- () => (0, import_provider_utils14.zodSchema)(
3141
- import_v411.z.object({
3142
- action: import_v411.z.enum([
3357
+ var import_provider_utils15 = require("@ai-sdk/provider-utils");
3358
+ var import_v412 = require("zod/v4");
3359
+ var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
3360
+ () => (0, import_provider_utils15.zodSchema)(
3361
+ import_v412.z.object({
3362
+ action: import_v412.z.enum([
3143
3363
  "key",
3144
3364
  "type",
3145
3365
  "mouse_move",
@@ -3151,23 +3371,23 @@ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
3151
3371
  "screenshot",
3152
3372
  "cursor_position"
3153
3373
  ]),
3154
- coordinate: import_v411.z.array(import_v411.z.number().int()).optional(),
3155
- text: import_v411.z.string().optional()
3374
+ coordinate: import_v412.z.array(import_v412.z.number().int()).optional(),
3375
+ text: import_v412.z.string().optional()
3156
3376
  })
3157
3377
  )
3158
3378
  );
3159
- var computer_20241022 = (0, import_provider_utils14.createProviderToolFactory)({
3379
+ var computer_20241022 = (0, import_provider_utils15.createProviderToolFactory)({
3160
3380
  id: "anthropic.computer_20241022",
3161
3381
  inputSchema: computer_20241022InputSchema
3162
3382
  });
3163
3383
 
3164
3384
  // src/tool/computer_20250124.ts
3165
- var import_provider_utils15 = require("@ai-sdk/provider-utils");
3166
- var import_v412 = require("zod/v4");
3167
- var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
3168
- () => (0, import_provider_utils15.zodSchema)(
3169
- import_v412.z.object({
3170
- action: import_v412.z.enum([
3385
+ var import_provider_utils16 = require("@ai-sdk/provider-utils");
3386
+ var import_v413 = require("zod/v4");
3387
+ var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
3388
+ () => (0, import_provider_utils16.zodSchema)(
3389
+ import_v413.z.object({
3390
+ action: import_v413.z.enum([
3171
3391
  "key",
3172
3392
  "hold_key",
3173
3393
  "type",
@@ -3185,90 +3405,69 @@ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
3185
3405
  "wait",
3186
3406
  "screenshot"
3187
3407
  ]),
3188
- coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
3189
- duration: import_v412.z.number().optional(),
3190
- scroll_amount: import_v412.z.number().optional(),
3191
- scroll_direction: import_v412.z.enum(["up", "down", "left", "right"]).optional(),
3192
- start_coordinate: import_v412.z.tuple([import_v412.z.number().int(), import_v412.z.number().int()]).optional(),
3193
- text: import_v412.z.string().optional()
3408
+ coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
3409
+ duration: import_v413.z.number().optional(),
3410
+ scroll_amount: import_v413.z.number().optional(),
3411
+ scroll_direction: import_v413.z.enum(["up", "down", "left", "right"]).optional(),
3412
+ start_coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
3413
+ text: import_v413.z.string().optional()
3194
3414
  })
3195
3415
  )
3196
3416
  );
3197
- var computer_20250124 = (0, import_provider_utils15.createProviderToolFactory)({
3417
+ var computer_20250124 = (0, import_provider_utils16.createProviderToolFactory)({
3198
3418
  id: "anthropic.computer_20250124",
3199
3419
  inputSchema: computer_20250124InputSchema
3200
3420
  });
3201
3421
 
3202
3422
  // src/tool/memory_20250818.ts
3203
- var import_provider_utils16 = require("@ai-sdk/provider-utils");
3204
- var import_v413 = require("zod/v4");
3205
- var memory_20250818InputSchema = (0, import_provider_utils16.lazySchema)(
3206
- () => (0, import_provider_utils16.zodSchema)(
3207
- import_v413.z.discriminatedUnion("command", [
3208
- import_v413.z.object({
3209
- command: import_v413.z.literal("view"),
3210
- path: import_v413.z.string(),
3211
- view_range: import_v413.z.tuple([import_v413.z.number(), import_v413.z.number()]).optional()
3423
+ var import_provider_utils17 = require("@ai-sdk/provider-utils");
3424
+ var import_v414 = require("zod/v4");
3425
+ var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
3426
+ () => (0, import_provider_utils17.zodSchema)(
3427
+ import_v414.z.discriminatedUnion("command", [
3428
+ import_v414.z.object({
3429
+ command: import_v414.z.literal("view"),
3430
+ path: import_v414.z.string(),
3431
+ view_range: import_v414.z.tuple([import_v414.z.number(), import_v414.z.number()]).optional()
3212
3432
  }),
3213
- import_v413.z.object({
3214
- command: import_v413.z.literal("create"),
3215
- path: import_v413.z.string(),
3216
- file_text: import_v413.z.string()
3433
+ import_v414.z.object({
3434
+ command: import_v414.z.literal("create"),
3435
+ path: import_v414.z.string(),
3436
+ file_text: import_v414.z.string()
3217
3437
  }),
3218
- import_v413.z.object({
3219
- command: import_v413.z.literal("str_replace"),
3220
- path: import_v413.z.string(),
3221
- old_str: import_v413.z.string(),
3222
- new_str: import_v413.z.string()
3438
+ import_v414.z.object({
3439
+ command: import_v414.z.literal("str_replace"),
3440
+ path: import_v414.z.string(),
3441
+ old_str: import_v414.z.string(),
3442
+ new_str: import_v414.z.string()
3223
3443
  }),
3224
- import_v413.z.object({
3225
- command: import_v413.z.literal("insert"),
3226
- path: import_v413.z.string(),
3227
- insert_line: import_v413.z.number(),
3228
- insert_text: import_v413.z.string()
3444
+ import_v414.z.object({
3445
+ command: import_v414.z.literal("insert"),
3446
+ path: import_v414.z.string(),
3447
+ insert_line: import_v414.z.number(),
3448
+ insert_text: import_v414.z.string()
3229
3449
  }),
3230
- import_v413.z.object({
3231
- command: import_v413.z.literal("delete"),
3232
- path: import_v413.z.string()
3450
+ import_v414.z.object({
3451
+ command: import_v414.z.literal("delete"),
3452
+ path: import_v414.z.string()
3233
3453
  }),
3234
- import_v413.z.object({
3235
- command: import_v413.z.literal("rename"),
3236
- old_path: import_v413.z.string(),
3237
- new_path: import_v413.z.string()
3454
+ import_v414.z.object({
3455
+ command: import_v414.z.literal("rename"),
3456
+ old_path: import_v414.z.string(),
3457
+ new_path: import_v414.z.string()
3238
3458
  })
3239
3459
  ])
3240
3460
  )
3241
3461
  );
3242
- var memory_20250818 = (0, import_provider_utils16.createProviderToolFactory)({
3462
+ var memory_20250818 = (0, import_provider_utils17.createProviderToolFactory)({
3243
3463
  id: "anthropic.memory_20250818",
3244
3464
  inputSchema: memory_20250818InputSchema
3245
3465
  });
3246
3466
 
3247
3467
  // src/tool/text-editor_20241022.ts
3248
- var import_provider_utils17 = require("@ai-sdk/provider-utils");
3249
- var import_v414 = require("zod/v4");
3250
- var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
3251
- () => (0, import_provider_utils17.zodSchema)(
3252
- import_v414.z.object({
3253
- command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
3254
- path: import_v414.z.string(),
3255
- file_text: import_v414.z.string().optional(),
3256
- insert_line: import_v414.z.number().int().optional(),
3257
- new_str: import_v414.z.string().optional(),
3258
- old_str: import_v414.z.string().optional(),
3259
- view_range: import_v414.z.array(import_v414.z.number().int()).optional()
3260
- })
3261
- )
3262
- );
3263
- var textEditor_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
3264
- id: "anthropic.text_editor_20241022",
3265
- inputSchema: textEditor_20241022InputSchema
3266
- });
3267
-
3268
- // src/tool/text-editor_20250124.ts
3269
3468
  var import_provider_utils18 = require("@ai-sdk/provider-utils");
3270
3469
  var import_v415 = require("zod/v4");
3271
- var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
3470
+ var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
3272
3471
  () => (0, import_provider_utils18.zodSchema)(
3273
3472
  import_v415.z.object({
3274
3473
  command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
@@ -3281,18 +3480,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
3281
3480
  })
3282
3481
  )
3283
3482
  );
3284
- var textEditor_20250124 = (0, import_provider_utils18.createProviderToolFactory)({
3285
- id: "anthropic.text_editor_20250124",
3286
- inputSchema: textEditor_20250124InputSchema
3483
+ var textEditor_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
3484
+ id: "anthropic.text_editor_20241022",
3485
+ inputSchema: textEditor_20241022InputSchema
3287
3486
  });
3288
3487
 
3289
- // src/tool/text-editor_20250429.ts
3488
+ // src/tool/text-editor_20250124.ts
3290
3489
  var import_provider_utils19 = require("@ai-sdk/provider-utils");
3291
3490
  var import_v416 = require("zod/v4");
3292
- var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
3491
+ var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
3293
3492
  () => (0, import_provider_utils19.zodSchema)(
3294
3493
  import_v416.z.object({
3295
- command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
3494
+ command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
3296
3495
  path: import_v416.z.string(),
3297
3496
  file_text: import_v416.z.string().optional(),
3298
3497
  insert_line: import_v416.z.number().int().optional(),
@@ -3302,11 +3501,69 @@ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
3302
3501
  })
3303
3502
  )
3304
3503
  );
3305
- var textEditor_20250429 = (0, import_provider_utils19.createProviderToolFactory)({
3504
+ var textEditor_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
3505
+ id: "anthropic.text_editor_20250124",
3506
+ inputSchema: textEditor_20250124InputSchema
3507
+ });
3508
+
3509
+ // src/tool/text-editor_20250429.ts
3510
+ var import_provider_utils20 = require("@ai-sdk/provider-utils");
3511
+ var import_v417 = require("zod/v4");
3512
+ var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
3513
+ () => (0, import_provider_utils20.zodSchema)(
3514
+ import_v417.z.object({
3515
+ command: import_v417.z.enum(["view", "create", "str_replace", "insert"]),
3516
+ path: import_v417.z.string(),
3517
+ file_text: import_v417.z.string().optional(),
3518
+ insert_line: import_v417.z.number().int().optional(),
3519
+ new_str: import_v417.z.string().optional(),
3520
+ old_str: import_v417.z.string().optional(),
3521
+ view_range: import_v417.z.array(import_v417.z.number().int()).optional()
3522
+ })
3523
+ )
3524
+ );
3525
+ var textEditor_20250429 = (0, import_provider_utils20.createProviderToolFactory)({
3306
3526
  id: "anthropic.text_editor_20250429",
3307
3527
  inputSchema: textEditor_20250429InputSchema
3308
3528
  });
3309
3529
 
3530
+ // src/tool/tool-search-bm25_20251119.ts
3531
+ var import_provider_utils21 = require("@ai-sdk/provider-utils");
3532
+ var import_v418 = require("zod/v4");
3533
+ var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils21.lazySchema)(
3534
+ () => (0, import_provider_utils21.zodSchema)(
3535
+ import_v418.z.array(
3536
+ import_v418.z.object({
3537
+ type: import_v418.z.literal("tool_reference"),
3538
+ toolName: import_v418.z.string()
3539
+ })
3540
+ )
3541
+ )
3542
+ );
3543
+ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils21.lazySchema)(
3544
+ () => (0, import_provider_utils21.zodSchema)(
3545
+ import_v418.z.object({
3546
+ /**
3547
+ * A natural language query to search for tools.
3548
+ * Claude will use BM25 text search to find relevant tools.
3549
+ */
3550
+ query: import_v418.z.string(),
3551
+ /**
3552
+ * Maximum number of tools to return. Optional.
3553
+ */
3554
+ limit: import_v418.z.number().optional()
3555
+ })
3556
+ )
3557
+ );
3558
+ var factory7 = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
3559
+ id: "anthropic.tool_search_bm25_20251119",
3560
+ inputSchema: toolSearchBm25_20251119InputSchema,
3561
+ outputSchema: toolSearchBm25_20251119OutputSchema
3562
+ });
3563
+ var toolSearchBm25_20251119 = (args = {}) => {
3564
+ return factory7(args);
3565
+ };
3566
+
3310
3567
  // src/anthropic-tools.ts
3311
3568
  var anthropicTools = {
3312
3569
  /**
@@ -3430,7 +3687,35 @@ var anthropicTools = {
3430
3687
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
3431
3688
  * @param userLocation - Optional user location information to provide geographically relevant search results.
3432
3689
  */
3433
- webSearch_20250305
3690
+ webSearch_20250305,
3691
+ /**
3692
+ * Creates a tool search tool that uses regex patterns to find tools.
3693
+ *
3694
+ * The tool search tool enables Claude to work with hundreds or thousands of tools
3695
+ * by dynamically discovering and loading them on-demand. Instead of loading all
3696
+ * tool definitions into the context window upfront, Claude searches your tool
3697
+ * catalog and loads only the tools it needs.
3698
+ *
3699
+ * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
3700
+ * to mark them for deferred loading.
3701
+ *
3702
+ * Supported models: Claude Opus 4.5, Claude Sonnet 4.5
3703
+ */
3704
+ toolSearchRegex_20251119,
3705
+ /**
3706
+ * Creates a tool search tool that uses BM25 (natural language) to find tools.
3707
+ *
3708
+ * The tool search tool enables Claude to work with hundreds or thousands of tools
3709
+ * by dynamically discovering and loading them on-demand. Instead of loading all
3710
+ * tool definitions into the context window upfront, Claude searches your tool
3711
+ * catalog and loads only the tools it needs.
3712
+ *
3713
+ * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
3714
+ * to mark them for deferred loading.
3715
+ *
3716
+ * Supported models: Claude Opus 4.5, Claude Sonnet 4.5
3717
+ */
3718
+ toolSearchBm25_20251119
3434
3719
  };
3435
3720
  // Annotate the CommonJS export names for ESM import in node:
3436
3721
  0 && (module.exports = {