@langchain/anthropic 1.2.3 → 1.3.0-dev-1765432861398

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.
Files changed (112) hide show
  1. package/README.md +620 -3
  2. package/dist/chat_models.cjs +8 -5
  3. package/dist/chat_models.cjs.map +1 -1
  4. package/dist/chat_models.d.cts +13 -16
  5. package/dist/chat_models.d.cts.map +1 -0
  6. package/dist/chat_models.d.ts +13 -16
  7. package/dist/chat_models.d.ts.map +1 -0
  8. package/dist/chat_models.js +7 -4
  9. package/dist/chat_models.js.map +1 -1
  10. package/dist/index.cjs +3 -1
  11. package/dist/index.d.cts +12 -2
  12. package/dist/index.d.ts +12 -2
  13. package/dist/index.js +2 -1
  14. package/dist/tools/bash.cjs +95 -0
  15. package/dist/tools/bash.cjs.map +1 -0
  16. package/dist/tools/bash.d.cts +99 -0
  17. package/dist/tools/bash.d.cts.map +1 -0
  18. package/dist/tools/bash.d.ts +99 -0
  19. package/dist/tools/bash.d.ts.map +1 -0
  20. package/dist/tools/bash.js +94 -0
  21. package/dist/tools/bash.js.map +1 -0
  22. package/dist/tools/codeExecution.cjs +70 -0
  23. package/dist/tools/codeExecution.cjs.map +1 -0
  24. package/dist/tools/codeExecution.d.cts +75 -0
  25. package/dist/tools/codeExecution.d.cts.map +1 -0
  26. package/dist/tools/codeExecution.d.ts +75 -0
  27. package/dist/tools/codeExecution.d.ts.map +1 -0
  28. package/dist/tools/codeExecution.js +69 -0
  29. package/dist/tools/codeExecution.js.map +1 -0
  30. package/dist/tools/computer.cjs +161 -0
  31. package/dist/tools/computer.cjs.map +1 -0
  32. package/dist/tools/computer.d.cts +289 -0
  33. package/dist/tools/computer.d.cts.map +1 -0
  34. package/dist/tools/computer.d.ts +289 -0
  35. package/dist/tools/computer.d.ts.map +1 -0
  36. package/dist/tools/computer.js +159 -0
  37. package/dist/tools/computer.js.map +1 -0
  38. package/dist/tools/index.cjs +28 -0
  39. package/dist/tools/index.cjs.map +1 -0
  40. package/dist/tools/index.d.cts +28 -0
  41. package/dist/tools/index.d.cts.map +1 -0
  42. package/dist/tools/index.d.ts +28 -0
  43. package/dist/tools/index.d.ts.map +1 -0
  44. package/dist/tools/index.js +28 -0
  45. package/dist/tools/index.js.map +1 -0
  46. package/dist/tools/mcpToolset.cjs +111 -0
  47. package/dist/tools/mcpToolset.cjs.map +1 -0
  48. package/dist/tools/mcpToolset.d.cts +141 -0
  49. package/dist/tools/mcpToolset.d.cts.map +1 -0
  50. package/dist/tools/mcpToolset.d.ts +141 -0
  51. package/dist/tools/mcpToolset.d.ts.map +1 -0
  52. package/dist/tools/mcpToolset.js +110 -0
  53. package/dist/tools/mcpToolset.js.map +1 -0
  54. package/dist/tools/memory.cjs +56 -0
  55. package/dist/tools/memory.cjs.map +1 -0
  56. package/dist/tools/memory.d.cts +92 -0
  57. package/dist/tools/memory.d.cts.map +1 -0
  58. package/dist/tools/memory.d.ts +92 -0
  59. package/dist/tools/memory.d.ts.map +1 -0
  60. package/dist/tools/memory.js +55 -0
  61. package/dist/tools/memory.js.map +1 -0
  62. package/dist/tools/textEditor.cjs +79 -0
  63. package/dist/tools/textEditor.cjs.map +1 -0
  64. package/dist/tools/textEditor.d.cts +114 -0
  65. package/dist/tools/textEditor.d.cts.map +1 -0
  66. package/dist/tools/textEditor.d.ts +114 -0
  67. package/dist/tools/textEditor.d.ts.map +1 -0
  68. package/dist/tools/textEditor.js +78 -0
  69. package/dist/tools/textEditor.js.map +1 -0
  70. package/dist/tools/toolSearch.cjs +110 -0
  71. package/dist/tools/toolSearch.cjs.map +1 -0
  72. package/dist/tools/toolSearch.d.cts +108 -0
  73. package/dist/tools/toolSearch.d.cts.map +1 -0
  74. package/dist/tools/toolSearch.d.ts +108 -0
  75. package/dist/tools/toolSearch.d.ts.map +1 -0
  76. package/dist/tools/toolSearch.js +108 -0
  77. package/dist/tools/toolSearch.js.map +1 -0
  78. package/dist/tools/types.cjs +204 -0
  79. package/dist/tools/types.cjs.map +1 -0
  80. package/dist/tools/types.d.cts +366 -0
  81. package/dist/tools/types.d.cts.map +1 -0
  82. package/dist/tools/types.d.ts +366 -0
  83. package/dist/tools/types.d.ts.map +1 -0
  84. package/dist/tools/types.js +199 -0
  85. package/dist/tools/types.js.map +1 -0
  86. package/dist/tools/webFetch.cjs +70 -0
  87. package/dist/tools/webFetch.cjs.map +1 -0
  88. package/dist/tools/webFetch.d.cts +96 -0
  89. package/dist/tools/webFetch.d.cts.map +1 -0
  90. package/dist/tools/webFetch.d.ts +96 -0
  91. package/dist/tools/webFetch.d.ts.map +1 -0
  92. package/dist/tools/webFetch.js +69 -0
  93. package/dist/tools/webFetch.js.map +1 -0
  94. package/dist/tools/webSearch.cjs +57 -0
  95. package/dist/tools/webSearch.cjs.map +1 -0
  96. package/dist/tools/webSearch.d.cts +84 -0
  97. package/dist/tools/webSearch.d.cts.map +1 -0
  98. package/dist/tools/webSearch.d.ts +84 -0
  99. package/dist/tools/webSearch.d.ts.map +1 -0
  100. package/dist/tools/webSearch.js +56 -0
  101. package/dist/tools/webSearch.js.map +1 -0
  102. package/dist/types.d.cts +2 -3
  103. package/dist/types.d.cts.map +1 -0
  104. package/dist/types.d.ts +2 -3
  105. package/dist/types.d.ts.map +1 -0
  106. package/dist/utils/prompts.d.cts.map +1 -0
  107. package/dist/utils/prompts.d.ts.map +1 -0
  108. package/dist/utils/tools.cjs +9 -2
  109. package/dist/utils/tools.cjs.map +1 -1
  110. package/dist/utils/tools.js +13 -6
  111. package/dist/utils/tools.js.map +1 -1
  112. package/package.json +8 -7
@@ -0,0 +1,78 @@
1
+ import { TextEditor20250728CommandSchema } from "./types.js";
2
+ import { tool } from "@langchain/core/tools";
3
+
4
+ //#region src/tools/textEditor.ts
5
+ /**
6
+ * Creates an Anthropic text editor tool for Claude 4.x models that can view and modify text files.
7
+ *
8
+ * The text editor tool enables Claude to view and modify text files, helping debug, fix,
9
+ * and improve code or other text documents. Claude can directly interact with files,
10
+ * providing hands-on assistance rather than just suggesting changes.
11
+ *
12
+ * Available commands:
13
+ * - `view`: Examine file contents or list directory contents
14
+ * - `str_replace`: Replace specific text in a file
15
+ * - `create`: Create a new file with specified content
16
+ * - `insert`: Insert text at a specific line number
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
21
+ * import * as fs from "fs";
22
+ *
23
+ * const llm = new ChatAnthropic({
24
+ * model: "claude-sonnet-4-5-20250929",
25
+ * });
26
+ *
27
+ * const textEditor = tools.textEditor_20250728({
28
+ * execute: async (args) => {
29
+ * if (args.command === "view") {
30
+ * const content = fs.readFileSync(args.path, "utf-8");
31
+ * return content.split("\n").map((line, i) => `${i + 1}: ${line}`).join("\n");
32
+ * }
33
+ * if (args.command === "str_replace") {
34
+ * let content = fs.readFileSync(args.path, "utf-8");
35
+ * content = content.replace(args.old_str!, args.new_str!);
36
+ * fs.writeFileSync(args.path, content);
37
+ * return "Successfully replaced text.";
38
+ * }
39
+ * // Handle other commands...
40
+ * return "Command executed";
41
+ * },
42
+ * maxCharacters: 10000,
43
+ * });
44
+ *
45
+ * const llmWithEditor = llm.bindTools([textEditor]);
46
+ * const response = await llmWithEditor.invoke(
47
+ * "There's a syntax error in my primes.py file. Can you help me fix it?"
48
+ * );
49
+ * ```
50
+ *
51
+ * @param options - Configuration options for the text editor tool
52
+ * @param options.execute - Function that handles text editor command execution
53
+ * @param options.maxCharacters - Maximum characters to return when viewing files
54
+ * @returns The text editor tool object that can be passed to `bindTools`
55
+ *
56
+ * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool
57
+ */
58
+ function textEditor_20250728(options) {
59
+ const name = "str_replace_based_edit_tool";
60
+ const textEditorTool = tool(options?.execute, {
61
+ name,
62
+ description: "A tool for editing text files",
63
+ schema: TextEditor20250728CommandSchema
64
+ });
65
+ textEditorTool.extras = {
66
+ ...textEditorTool.extras ?? {},
67
+ providerToolDefinition: {
68
+ type: "text_editor_20250728",
69
+ name,
70
+ ...options?.maxCharacters !== void 0 && { max_characters: options.maxCharacters }
71
+ }
72
+ };
73
+ return textEditorTool;
74
+ }
75
+
76
+ //#endregion
77
+ export { textEditor_20250728 };
78
+ //# sourceMappingURL=textEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textEditor.js","names":["options?: TextEditor20250728Options"],"sources":["../../src/tools/textEditor.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { tool } from \"@langchain/core/tools\";\nimport type { DynamicStructuredTool, ToolRuntime } from \"@langchain/core/tools\";\n\nimport {\n TextEditor20250728CommandSchema,\n type TextEditor20250728Command,\n} from \"./types.js\";\n\n/**\n * Options for the text editor tool (Claude 4.x version).\n */\nexport interface TextEditor20250728Options {\n /**\n * Optional execute function that handles text editor command execution.\n * This function receives the command input and should return the result.\n */\n execute?: (args: TextEditor20250728Command) => string | Promise<string>;\n /**\n * Optional maximum characters to return when viewing files.\n * If the file content exceeds this limit, it will be truncated.\n */\n maxCharacters?: number;\n}\n\n/**\n * Creates an Anthropic text editor tool for Claude 4.x models that can view and modify text files.\n *\n * The text editor tool enables Claude to view and modify text files, helping debug, fix,\n * and improve code or other text documents. Claude can directly interact with files,\n * providing hands-on assistance rather than just suggesting changes.\n *\n * Available commands:\n * - `view`: Examine file contents or list directory contents\n * - `str_replace`: Replace specific text in a file\n * - `create`: Create a new file with specified content\n * - `insert`: Insert text at a specific line number\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n * import * as fs from \"fs\";\n *\n * const llm = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * });\n *\n * const textEditor = tools.textEditor_20250728({\n * execute: async (args) => {\n * if (args.command === \"view\") {\n * const content = fs.readFileSync(args.path, \"utf-8\");\n * return content.split(\"\\n\").map((line, i) => `${i + 1}: ${line}`).join(\"\\n\");\n * }\n * if (args.command === \"str_replace\") {\n * let content = fs.readFileSync(args.path, \"utf-8\");\n * content = content.replace(args.old_str!, args.new_str!);\n * fs.writeFileSync(args.path, content);\n * return \"Successfully replaced text.\";\n * }\n * // Handle other commands...\n * return \"Command executed\";\n * },\n * maxCharacters: 10000,\n * });\n *\n * const llmWithEditor = llm.bindTools([textEditor]);\n * const response = await llmWithEditor.invoke(\n * \"There's a syntax error in my primes.py file. Can you help me fix it?\"\n * );\n * ```\n *\n * @param options - Configuration options for the text editor tool\n * @param options.execute - Function that handles text editor command execution\n * @param options.maxCharacters - Maximum characters to return when viewing files\n * @returns The text editor tool object that can be passed to `bindTools`\n *\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool\n */\nexport function textEditor_20250728(options?: TextEditor20250728Options) {\n const name = \"str_replace_based_edit_tool\";\n const textEditorTool = tool(\n options?.execute as (\n input: unknown,\n runtime: ToolRuntime<unknown, unknown>\n ) => string | Promise<string>,\n {\n name,\n description: \"A tool for editing text files\",\n schema: TextEditor20250728CommandSchema,\n }\n );\n\n textEditorTool.extras = {\n ...(textEditorTool.extras ?? {}),\n providerToolDefinition: {\n type: \"text_editor_20250728\",\n name,\n ...(options?.maxCharacters !== undefined && {\n max_characters: options.maxCharacters,\n }),\n } satisfies Anthropic.Beta.Messages.BetaToolTextEditor20250728,\n };\n\n return textEditorTool as DynamicStructuredTool<\n typeof TextEditor20250728CommandSchema,\n TextEditor20250728Command,\n unknown,\n string | Promise<string>\n >;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,SAAgB,oBAAoBA,SAAqC;CACvE,MAAM,OAAO;CACb,MAAM,iBAAiB,KACrB,SAAS,SAIT;EACE;EACA,aAAa;EACb,QAAQ;CACT,EACF;CAED,eAAe,SAAS;EACtB,GAAI,eAAe,UAAU,CAAE;EAC/B,wBAAwB;GACtB,MAAM;GACN;GACA,GAAI,SAAS,kBAAkB,UAAa,EAC1C,gBAAgB,QAAQ,cACzB;EACF;CACF;AAED,QAAO;AAMR"}
@@ -0,0 +1,110 @@
1
+
2
+ //#region src/tools/toolSearch.ts
3
+ /**
4
+ * Creates a regex-based tool search tool that enables Claude to work with hundreds
5
+ * or thousands of tools by dynamically discovering and loading them on-demand.
6
+ * Claude constructs regex patterns (using Python's `re.search()` syntax) to search
7
+ * for tools by name, description, argument names, and argument descriptions.
8
+ *
9
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
10
+ *
11
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
12
+ * @param options - Configuration options for the tool search tool
13
+ * @returns A tool search tool definition to be passed to the Anthropic API
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
18
+ *
19
+ * const model = new ChatAnthropic({
20
+ * model: "claude-sonnet-4-5-20250929",
21
+ * });
22
+ *
23
+ * const getWeather = tool(
24
+ * async (input: { location: string }) => {
25
+ * return `Weather in ${input.location}`;
26
+ * },
27
+ * {
28
+ * name: "get_weather",
29
+ * description: "Get the weather at a specific location",
30
+ * schema: z.object({
31
+ * location: z.string(),
32
+ * }),
33
+ * extras: { defer_loading: true },
34
+ * },
35
+ * );
36
+ *
37
+ * // Use with deferred tools - Claude will search and discover tools as needed
38
+ * const response = await model.invoke("What is the weather in San Francisco?", {
39
+ * tools: [
40
+ * tools.toolSearchRegex_20251119(),
41
+ * getWeather,
42
+ * ],
43
+ * });
44
+ * ```
45
+ */
46
+ function toolSearchRegex_20251119(options) {
47
+ return {
48
+ type: "tool_search_tool_regex_20251119",
49
+ name: "tool_search_tool_regex",
50
+ cache_control: options?.cacheControl
51
+ };
52
+ }
53
+ /**
54
+ * Creates a BM25-based tool search tool that enables Claude to work with hundreds
55
+ * or thousands of tools by dynamically discovering and loading them on-demand.
56
+ * Claude uses natural language queries to search for tools by name, description,
57
+ * argument names, and argument descriptions.
58
+ *
59
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
60
+ *
61
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
62
+ * @param options - Configuration options for the tool search tool
63
+ * @returns A tool search tool definition to be passed to the Anthropic API
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
68
+ *
69
+ * const model = new ChatAnthropic({
70
+ * model: "claude-sonnet-4-5-20250929",
71
+ * clientOptions: {
72
+ * defaultHeaders: { "anthropic-beta": "advanced-tool-use-2025-11-20" },
73
+ * },
74
+ * });
75
+ *
76
+ * const getWeather = tool(
77
+ * async (input: { location: string }) => {
78
+ * return `Weather in ${input.location}`;
79
+ * },
80
+ * {
81
+ * name: "get_weather",
82
+ * description: "Get the weather at a specific location",
83
+ * schema: z.object({
84
+ * location: z.string(),
85
+ * }),
86
+ * extras: { defer_loading: true },
87
+ * },
88
+ * );
89
+ *
90
+ * // Use with deferred tools - Claude will search using natural language
91
+ * const response = await model.invoke("What is the weather in San Francisco?", {
92
+ * tools: [
93
+ * tools.toolSearchBM25_20251119(),
94
+ * getWeather,
95
+ * ],
96
+ * });
97
+ * ```
98
+ */
99
+ function toolSearchBM25_20251119(options) {
100
+ return {
101
+ type: "tool_search_tool_bm25_20251119",
102
+ name: "tool_search_tool_bm25",
103
+ cache_control: options?.cacheControl
104
+ };
105
+ }
106
+
107
+ //#endregion
108
+ exports.toolSearchBM25_20251119 = toolSearchBM25_20251119;
109
+ exports.toolSearchRegex_20251119 = toolSearchRegex_20251119;
110
+ //# sourceMappingURL=toolSearch.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolSearch.cjs","names":["options?: ToolSearchOptions"],"sources":["../../src/tools/toolSearch.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { type ServerTool } from \"@langchain/core/tools\";\n\n/**\n * Options for the tool search tool.\n */\nexport interface ToolSearchOptions {\n /**\n * Create a cache control breakpoint at this content block.\n */\n cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;\n}\n\n/**\n * Creates a regex-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude constructs regex patterns (using Python's `re.search()` syntax) to search\n * for tools by name, description, argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search and discover tools as needed\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchRegex_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport function toolSearchRegex_20251119(\n options?: ToolSearchOptions\n): ServerTool {\n return {\n type: \"tool_search_tool_regex_20251119\",\n name: \"tool_search_tool_regex\",\n cache_control: options?.cacheControl,\n } satisfies Anthropic.Beta.Messages.BetaToolSearchToolRegex20251119;\n}\n\n/**\n * Creates a BM25-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude uses natural language queries to search for tools by name, description,\n * argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * clientOptions: {\n * defaultHeaders: { \"anthropic-beta\": \"advanced-tool-use-2025-11-20\" },\n * },\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search using natural language\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchBM25_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport function toolSearchBM25_20251119(\n options?: ToolSearchOptions\n): ServerTool {\n return {\n type: \"tool_search_tool_bm25_20251119\",\n name: \"tool_search_tool_bm25\",\n cache_control: options?.cacheControl,\n } satisfies Anthropic.Beta.Messages.BetaToolSearchToolBm25_20251119;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgB,yBACdA,SACY;AACZ,QAAO;EACL,MAAM;EACN,MAAM;EACN,eAAe,SAAS;CACzB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDD,SAAgB,wBACdA,SACY;AACZ,QAAO;EACL,MAAM;EACN,MAAM;EACN,eAAe,SAAS;CACzB;AACF"}
@@ -0,0 +1,108 @@
1
+ import Anthropic from "@anthropic-ai/sdk";
2
+ import { ServerTool } from "@langchain/core/tools";
3
+
4
+ //#region src/tools/toolSearch.d.ts
5
+
6
+ /**
7
+ * Options for the tool search tool.
8
+ */
9
+ interface ToolSearchOptions {
10
+ /**
11
+ * Create a cache control breakpoint at this content block.
12
+ */
13
+ cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;
14
+ }
15
+ /**
16
+ * Creates a regex-based tool search tool that enables Claude to work with hundreds
17
+ * or thousands of tools by dynamically discovering and loading them on-demand.
18
+ * Claude constructs regex patterns (using Python's `re.search()` syntax) to search
19
+ * for tools by name, description, argument names, and argument descriptions.
20
+ *
21
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
22
+ *
23
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
24
+ * @param options - Configuration options for the tool search tool
25
+ * @returns A tool search tool definition to be passed to the Anthropic API
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
30
+ *
31
+ * const model = new ChatAnthropic({
32
+ * model: "claude-sonnet-4-5-20250929",
33
+ * });
34
+ *
35
+ * const getWeather = tool(
36
+ * async (input: { location: string }) => {
37
+ * return `Weather in ${input.location}`;
38
+ * },
39
+ * {
40
+ * name: "get_weather",
41
+ * description: "Get the weather at a specific location",
42
+ * schema: z.object({
43
+ * location: z.string(),
44
+ * }),
45
+ * extras: { defer_loading: true },
46
+ * },
47
+ * );
48
+ *
49
+ * // Use with deferred tools - Claude will search and discover tools as needed
50
+ * const response = await model.invoke("What is the weather in San Francisco?", {
51
+ * tools: [
52
+ * tools.toolSearchRegex_20251119(),
53
+ * getWeather,
54
+ * ],
55
+ * });
56
+ * ```
57
+ */
58
+ declare function toolSearchRegex_20251119(options?: ToolSearchOptions): ServerTool;
59
+ /**
60
+ * Creates a BM25-based tool search tool that enables Claude to work with hundreds
61
+ * or thousands of tools by dynamically discovering and loading them on-demand.
62
+ * Claude uses natural language queries to search for tools by name, description,
63
+ * argument names, and argument descriptions.
64
+ *
65
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
66
+ *
67
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
68
+ * @param options - Configuration options for the tool search tool
69
+ * @returns A tool search tool definition to be passed to the Anthropic API
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
74
+ *
75
+ * const model = new ChatAnthropic({
76
+ * model: "claude-sonnet-4-5-20250929",
77
+ * clientOptions: {
78
+ * defaultHeaders: { "anthropic-beta": "advanced-tool-use-2025-11-20" },
79
+ * },
80
+ * });
81
+ *
82
+ * const getWeather = tool(
83
+ * async (input: { location: string }) => {
84
+ * return `Weather in ${input.location}`;
85
+ * },
86
+ * {
87
+ * name: "get_weather",
88
+ * description: "Get the weather at a specific location",
89
+ * schema: z.object({
90
+ * location: z.string(),
91
+ * }),
92
+ * extras: { defer_loading: true },
93
+ * },
94
+ * );
95
+ *
96
+ * // Use with deferred tools - Claude will search using natural language
97
+ * const response = await model.invoke("What is the weather in San Francisco?", {
98
+ * tools: [
99
+ * tools.toolSearchBM25_20251119(),
100
+ * getWeather,
101
+ * ],
102
+ * });
103
+ * ```
104
+ */
105
+ declare function toolSearchBM25_20251119(options?: ToolSearchOptions): ServerTool;
106
+ //#endregion
107
+ export { ToolSearchOptions, toolSearchBM25_20251119, toolSearchRegex_20251119 };
108
+ //# sourceMappingURL=toolSearch.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolSearch.d.cts","names":["Anthropic","ServerTool","ToolSearchOptions","Beta","BetaCacheControlEphemeral","toolSearchRegex_20251119","toolSearchBM25_20251119"],"sources":["../../src/tools/toolSearch.d.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { type ServerTool } from \"@langchain/core/tools\";\n/**\n * Options for the tool search tool.\n */\nexport interface ToolSearchOptions {\n /**\n * Create a cache control breakpoint at this content block.\n */\n cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;\n}\n/**\n * Creates a regex-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude constructs regex patterns (using Python's `re.search()` syntax) to search\n * for tools by name, description, argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search and discover tools as needed\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchRegex_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport declare function toolSearchRegex_20251119(options?: ToolSearchOptions): ServerTool;\n/**\n * Creates a BM25-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude uses natural language queries to search for tools by name, description,\n * argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * clientOptions: {\n * defaultHeaders: { \"anthropic-beta\": \"advanced-tool-use-2025-11-20\" },\n * },\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search using natural language\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchBM25_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport declare function toolSearchBM25_20251119(options?: ToolSearchOptions): ServerTool;\n//# sourceMappingURL=toolSearch.d.ts.map"],"mappings":";;;;;;;AAKA;AAiDwBK,UAjDPH,iBAAAA,CAiD+B;EA+CxBI;;;iBA5FLN,SAAAA,CAAUG,IAAAA,CAAKC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6CVC,wBAAAA,WAAmCH,oBAAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CvDK,uBAAAA,WAAkCJ,oBAAoBD"}
@@ -0,0 +1,108 @@
1
+ import Anthropic from "@anthropic-ai/sdk";
2
+ import { ServerTool } from "@langchain/core/tools";
3
+
4
+ //#region src/tools/toolSearch.d.ts
5
+
6
+ /**
7
+ * Options for the tool search tool.
8
+ */
9
+ interface ToolSearchOptions {
10
+ /**
11
+ * Create a cache control breakpoint at this content block.
12
+ */
13
+ cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;
14
+ }
15
+ /**
16
+ * Creates a regex-based tool search tool that enables Claude to work with hundreds
17
+ * or thousands of tools by dynamically discovering and loading them on-demand.
18
+ * Claude constructs regex patterns (using Python's `re.search()` syntax) to search
19
+ * for tools by name, description, argument names, and argument descriptions.
20
+ *
21
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
22
+ *
23
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
24
+ * @param options - Configuration options for the tool search tool
25
+ * @returns A tool search tool definition to be passed to the Anthropic API
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
30
+ *
31
+ * const model = new ChatAnthropic({
32
+ * model: "claude-sonnet-4-5-20250929",
33
+ * });
34
+ *
35
+ * const getWeather = tool(
36
+ * async (input: { location: string }) => {
37
+ * return `Weather in ${input.location}`;
38
+ * },
39
+ * {
40
+ * name: "get_weather",
41
+ * description: "Get the weather at a specific location",
42
+ * schema: z.object({
43
+ * location: z.string(),
44
+ * }),
45
+ * extras: { defer_loading: true },
46
+ * },
47
+ * );
48
+ *
49
+ * // Use with deferred tools - Claude will search and discover tools as needed
50
+ * const response = await model.invoke("What is the weather in San Francisco?", {
51
+ * tools: [
52
+ * tools.toolSearchRegex_20251119(),
53
+ * getWeather,
54
+ * ],
55
+ * });
56
+ * ```
57
+ */
58
+ declare function toolSearchRegex_20251119(options?: ToolSearchOptions): ServerTool;
59
+ /**
60
+ * Creates a BM25-based tool search tool that enables Claude to work with hundreds
61
+ * or thousands of tools by dynamically discovering and loading them on-demand.
62
+ * Claude uses natural language queries to search for tools by name, description,
63
+ * argument names, and argument descriptions.
64
+ *
65
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
66
+ *
67
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
68
+ * @param options - Configuration options for the tool search tool
69
+ * @returns A tool search tool definition to be passed to the Anthropic API
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
74
+ *
75
+ * const model = new ChatAnthropic({
76
+ * model: "claude-sonnet-4-5-20250929",
77
+ * clientOptions: {
78
+ * defaultHeaders: { "anthropic-beta": "advanced-tool-use-2025-11-20" },
79
+ * },
80
+ * });
81
+ *
82
+ * const getWeather = tool(
83
+ * async (input: { location: string }) => {
84
+ * return `Weather in ${input.location}`;
85
+ * },
86
+ * {
87
+ * name: "get_weather",
88
+ * description: "Get the weather at a specific location",
89
+ * schema: z.object({
90
+ * location: z.string(),
91
+ * }),
92
+ * extras: { defer_loading: true },
93
+ * },
94
+ * );
95
+ *
96
+ * // Use with deferred tools - Claude will search using natural language
97
+ * const response = await model.invoke("What is the weather in San Francisco?", {
98
+ * tools: [
99
+ * tools.toolSearchBM25_20251119(),
100
+ * getWeather,
101
+ * ],
102
+ * });
103
+ * ```
104
+ */
105
+ declare function toolSearchBM25_20251119(options?: ToolSearchOptions): ServerTool;
106
+ //#endregion
107
+ export { ToolSearchOptions, toolSearchBM25_20251119, toolSearchRegex_20251119 };
108
+ //# sourceMappingURL=toolSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolSearch.d.ts","names":["Anthropic","ServerTool","ToolSearchOptions","Beta","BetaCacheControlEphemeral","toolSearchRegex_20251119","toolSearchBM25_20251119"],"sources":["../../src/tools/toolSearch.d.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { type ServerTool } from \"@langchain/core/tools\";\n/**\n * Options for the tool search tool.\n */\nexport interface ToolSearchOptions {\n /**\n * Create a cache control breakpoint at this content block.\n */\n cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;\n}\n/**\n * Creates a regex-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude constructs regex patterns (using Python's `re.search()` syntax) to search\n * for tools by name, description, argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search and discover tools as needed\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchRegex_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport declare function toolSearchRegex_20251119(options?: ToolSearchOptions): ServerTool;\n/**\n * Creates a BM25-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude uses natural language queries to search for tools by name, description,\n * argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * clientOptions: {\n * defaultHeaders: { \"anthropic-beta\": \"advanced-tool-use-2025-11-20\" },\n * },\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search using natural language\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchBM25_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport declare function toolSearchBM25_20251119(options?: ToolSearchOptions): ServerTool;\n//# sourceMappingURL=toolSearch.d.ts.map"],"mappings":";;;;;;;AAKA;AAiDwBK,UAjDPH,iBAAAA,CAiD+B;EA+CxBI;;;iBA5FLN,SAAAA,CAAUG,IAAAA,CAAKC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6CVC,wBAAAA,WAAmCH,oBAAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CvDK,uBAAAA,WAAkCJ,oBAAoBD"}
@@ -0,0 +1,108 @@
1
+ //#region src/tools/toolSearch.ts
2
+ /**
3
+ * Creates a regex-based tool search tool that enables Claude to work with hundreds
4
+ * or thousands of tools by dynamically discovering and loading them on-demand.
5
+ * Claude constructs regex patterns (using Python's `re.search()` syntax) to search
6
+ * for tools by name, description, argument names, and argument descriptions.
7
+ *
8
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
9
+ *
10
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
11
+ * @param options - Configuration options for the tool search tool
12
+ * @returns A tool search tool definition to be passed to the Anthropic API
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
17
+ *
18
+ * const model = new ChatAnthropic({
19
+ * model: "claude-sonnet-4-5-20250929",
20
+ * });
21
+ *
22
+ * const getWeather = tool(
23
+ * async (input: { location: string }) => {
24
+ * return `Weather in ${input.location}`;
25
+ * },
26
+ * {
27
+ * name: "get_weather",
28
+ * description: "Get the weather at a specific location",
29
+ * schema: z.object({
30
+ * location: z.string(),
31
+ * }),
32
+ * extras: { defer_loading: true },
33
+ * },
34
+ * );
35
+ *
36
+ * // Use with deferred tools - Claude will search and discover tools as needed
37
+ * const response = await model.invoke("What is the weather in San Francisco?", {
38
+ * tools: [
39
+ * tools.toolSearchRegex_20251119(),
40
+ * getWeather,
41
+ * ],
42
+ * });
43
+ * ```
44
+ */
45
+ function toolSearchRegex_20251119(options) {
46
+ return {
47
+ type: "tool_search_tool_regex_20251119",
48
+ name: "tool_search_tool_regex",
49
+ cache_control: options?.cacheControl
50
+ };
51
+ }
52
+ /**
53
+ * Creates a BM25-based tool search tool that enables Claude to work with hundreds
54
+ * or thousands of tools by dynamically discovering and loading them on-demand.
55
+ * Claude uses natural language queries to search for tools by name, description,
56
+ * argument names, and argument descriptions.
57
+ *
58
+ * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.
59
+ *
60
+ * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}
61
+ * @param options - Configuration options for the tool search tool
62
+ * @returns A tool search tool definition to be passed to the Anthropic API
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
67
+ *
68
+ * const model = new ChatAnthropic({
69
+ * model: "claude-sonnet-4-5-20250929",
70
+ * clientOptions: {
71
+ * defaultHeaders: { "anthropic-beta": "advanced-tool-use-2025-11-20" },
72
+ * },
73
+ * });
74
+ *
75
+ * const getWeather = tool(
76
+ * async (input: { location: string }) => {
77
+ * return `Weather in ${input.location}`;
78
+ * },
79
+ * {
80
+ * name: "get_weather",
81
+ * description: "Get the weather at a specific location",
82
+ * schema: z.object({
83
+ * location: z.string(),
84
+ * }),
85
+ * extras: { defer_loading: true },
86
+ * },
87
+ * );
88
+ *
89
+ * // Use with deferred tools - Claude will search using natural language
90
+ * const response = await model.invoke("What is the weather in San Francisco?", {
91
+ * tools: [
92
+ * tools.toolSearchBM25_20251119(),
93
+ * getWeather,
94
+ * ],
95
+ * });
96
+ * ```
97
+ */
98
+ function toolSearchBM25_20251119(options) {
99
+ return {
100
+ type: "tool_search_tool_bm25_20251119",
101
+ name: "tool_search_tool_bm25",
102
+ cache_control: options?.cacheControl
103
+ };
104
+ }
105
+
106
+ //#endregion
107
+ export { toolSearchBM25_20251119, toolSearchRegex_20251119 };
108
+ //# sourceMappingURL=toolSearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolSearch.js","names":["options?: ToolSearchOptions"],"sources":["../../src/tools/toolSearch.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { type ServerTool } from \"@langchain/core/tools\";\n\n/**\n * Options for the tool search tool.\n */\nexport interface ToolSearchOptions {\n /**\n * Create a cache control breakpoint at this content block.\n */\n cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;\n}\n\n/**\n * Creates a regex-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude constructs regex patterns (using Python's `re.search()` syntax) to search\n * for tools by name, description, argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search and discover tools as needed\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchRegex_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport function toolSearchRegex_20251119(\n options?: ToolSearchOptions\n): ServerTool {\n return {\n type: \"tool_search_tool_regex_20251119\",\n name: \"tool_search_tool_regex\",\n cache_control: options?.cacheControl,\n } satisfies Anthropic.Beta.Messages.BetaToolSearchToolRegex20251119;\n}\n\n/**\n * Creates a BM25-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude uses natural language queries to search for tools by name, description,\n * argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool search tool definition to be passed to the Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * clientOptions: {\n * defaultHeaders: { \"anthropic-beta\": \"advanced-tool-use-2025-11-20\" },\n * },\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search using natural language\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchBM25_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport function toolSearchBM25_20251119(\n options?: ToolSearchOptions\n): ServerTool {\n return {\n type: \"tool_search_tool_bm25_20251119\",\n name: \"tool_search_tool_bm25\",\n cache_control: options?.cacheControl,\n } satisfies Anthropic.Beta.Messages.BetaToolSearchToolBm25_20251119;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgB,yBACdA,SACY;AACZ,QAAO;EACL,MAAM;EACN,MAAM;EACN,eAAe,SAAS;CACzB;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDD,SAAgB,wBACdA,SACY;AACZ,QAAO;EACL,MAAM;EACN,MAAM;EACN,eAAe,SAAS;CACzB;AACF"}