@tanstack/ai-anthropic 0.7.5 → 0.8.0

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 (45) hide show
  1. package/dist/esm/adapters/text.d.ts +5 -4
  2. package/dist/esm/adapters/text.js.map +1 -1
  3. package/dist/esm/index.d.ts +1 -1
  4. package/dist/esm/model-meta.d.ts +28 -0
  5. package/dist/esm/model-meta.js.map +1 -1
  6. package/dist/esm/tools/bash-tool.d.ts +7 -4
  7. package/dist/esm/tools/bash-tool.js +8 -0
  8. package/dist/esm/tools/bash-tool.js.map +1 -1
  9. package/dist/esm/tools/code-execution-tool.d.ts +7 -4
  10. package/dist/esm/tools/code-execution-tool.js +8 -0
  11. package/dist/esm/tools/code-execution-tool.js.map +1 -1
  12. package/dist/esm/tools/computer-use-tool.d.ts +7 -4
  13. package/dist/esm/tools/computer-use-tool.js +8 -0
  14. package/dist/esm/tools/computer-use-tool.js.map +1 -1
  15. package/dist/esm/tools/custom-tool.d.ts +4 -2
  16. package/dist/esm/tools/custom-tool.js +12 -1
  17. package/dist/esm/tools/custom-tool.js.map +1 -1
  18. package/dist/esm/tools/index.d.ts +8 -1
  19. package/dist/esm/tools/index.js +19 -0
  20. package/dist/esm/tools/index.js.map +1 -0
  21. package/dist/esm/tools/memory-tool.d.ts +7 -4
  22. package/dist/esm/tools/memory-tool.js +9 -1
  23. package/dist/esm/tools/memory-tool.js.map +1 -1
  24. package/dist/esm/tools/text-editor-tool.d.ts +7 -4
  25. package/dist/esm/tools/text-editor-tool.js +9 -1
  26. package/dist/esm/tools/text-editor-tool.js.map +1 -1
  27. package/dist/esm/tools/web-fetch-tool.d.ts +7 -4
  28. package/dist/esm/tools/web-fetch-tool.js +9 -1
  29. package/dist/esm/tools/web-fetch-tool.js.map +1 -1
  30. package/dist/esm/tools/web-search-tool.d.ts +7 -4
  31. package/dist/esm/tools/web-search-tool.js +41 -1
  32. package/dist/esm/tools/web-search-tool.js.map +1 -1
  33. package/package.json +7 -3
  34. package/src/adapters/text.ts +13 -4
  35. package/src/index.ts +2 -1
  36. package/src/model-meta.ts +126 -0
  37. package/src/tools/bash-tool.ts +13 -6
  38. package/src/tools/code-execution-tool.ts +17 -6
  39. package/src/tools/computer-use-tool.ts +14 -6
  40. package/src/tools/custom-tool.ts +5 -3
  41. package/src/tools/index.ts +49 -12
  42. package/src/tools/memory-tool.ts +12 -6
  43. package/src/tools/text-editor-tool.ts +14 -6
  44. package/src/tools/web-fetch-tool.ts +15 -7
  45. package/src/tools/web-search-tool.ts +17 -7
@@ -1,6 +1,6 @@
1
1
  import { SchemaInput, Tool } from '@tanstack/ai';
2
2
  import { CacheControl } from '../text/text-provider-options.js';
3
- export interface CustomTool {
3
+ export interface CustomToolConfig {
4
4
  /**
5
5
  * The name of the tool.
6
6
  */
@@ -20,5 +20,7 @@ export interface CustomTool {
20
20
  };
21
21
  cache_control?: CacheControl | null;
22
22
  }
23
- export declare function convertCustomToolToAdapterFormat(tool: Tool): CustomTool;
23
+ /** @deprecated Renamed to `CustomToolConfig`. Will be removed in a future release. */
24
+ export type CustomTool = CustomToolConfig;
25
+ export declare function convertCustomToolToAdapterFormat(tool: Tool): CustomToolConfig;
24
26
  export declare function customTool(name: string, description: string, inputSchema: SchemaInput, cacheControl?: CacheControl | null): Tool;
@@ -17,7 +17,18 @@ function convertCustomToolToAdapterFormat(tool) {
17
17
  cache_control: metadata.cacheControl || null
18
18
  };
19
19
  }
20
+ function customTool(name, description, inputSchema, cacheControl) {
21
+ return {
22
+ name,
23
+ description,
24
+ inputSchema,
25
+ metadata: {
26
+ cacheControl
27
+ }
28
+ };
29
+ }
20
30
  export {
21
- convertCustomToolToAdapterFormat
31
+ convertCustomToolToAdapterFormat,
32
+ customTool
22
33
  };
23
34
  //# sourceMappingURL=custom-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-tool.js","sources":["../../../src/tools/custom-tool.ts"],"sourcesContent":["import type { JSONSchema, SchemaInput, Tool } from '@tanstack/ai'\nimport type { CacheControl } from '../text/text-provider-options'\n\nexport interface CustomTool {\n /**\n * The name of the tool.\n */\n name: string\n type: 'custom'\n /**\n * A brief description of what the tool does. Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.\n */\n description: string\n /**\n * This defines the shape of the input that your tool accepts and that the model will produce.\n */\n input_schema: {\n type: 'object'\n properties: Record<string, any> | null\n required?: Array<string> | null\n }\n\n cache_control?: CacheControl | null\n}\n\nexport function convertCustomToolToAdapterFormat(tool: Tool): CustomTool {\n const metadata =\n (tool.metadata as { cacheControl?: CacheControl | null } | undefined) || {}\n\n // Tool schemas are already converted to JSON Schema in the ai layer\n const jsonSchema = (tool.inputSchema ?? {\n type: 'object',\n properties: {},\n required: [],\n }) as JSONSchema\n\n const inputSchema = {\n type: 'object' as const,\n properties: jsonSchema.properties || null,\n required: jsonSchema.required || null,\n }\n\n return {\n name: tool.name,\n type: 'custom',\n description: tool.description,\n input_schema: inputSchema,\n cache_control: metadata.cacheControl || null,\n }\n}\n\nexport function customTool(\n name: string,\n description: string,\n inputSchema: SchemaInput,\n cacheControl?: CacheControl | null,\n): Tool {\n return {\n name,\n description,\n inputSchema,\n metadata: {\n cacheControl,\n },\n }\n}\n"],"names":[],"mappings":"AAyBO,SAAS,iCAAiC,MAAwB;AACvE,QAAM,WACH,KAAK,YAAmE,CAAA;AAG3E,QAAM,aAAc,KAAK,eAAe;AAAA,IAEtC,YAAY,CAAA;AAAA,IACZ,UAAU,CAAA;AAAA,EAAC;AAGb,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,IACN,YAAY,WAAW,cAAc;AAAA,IACrC,UAAU,WAAW,YAAY;AAAA,EAAA;AAGnC,SAAO;AAAA,IACL,MAAM,KAAK;AAAA,IACX,MAAM;AAAA,IACN,aAAa,KAAK;AAAA,IAClB,cAAc;AAAA,IACd,eAAe,SAAS,gBAAgB;AAAA,EAAA;AAE5C;"}
1
+ {"version":3,"file":"custom-tool.js","sources":["../../../src/tools/custom-tool.ts"],"sourcesContent":["import type { JSONSchema, SchemaInput, Tool } from '@tanstack/ai'\nimport type { CacheControl } from '../text/text-provider-options'\n\nexport interface CustomToolConfig {\n /**\n * The name of the tool.\n */\n name: string\n type: 'custom'\n /**\n * A brief description of what the tool does. Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.\n */\n description: string\n /**\n * This defines the shape of the input that your tool accepts and that the model will produce.\n */\n input_schema: {\n type: 'object'\n properties: Record<string, any> | null\n required?: Array<string> | null\n }\n\n cache_control?: CacheControl | null\n}\n\n/** @deprecated Renamed to `CustomToolConfig`. Will be removed in a future release. */\nexport type CustomTool = CustomToolConfig\n\nexport function convertCustomToolToAdapterFormat(tool: Tool): CustomToolConfig {\n const metadata =\n (tool.metadata as { cacheControl?: CacheControl | null } | undefined) || {}\n\n const jsonSchema = (tool.inputSchema ?? {\n type: 'object',\n properties: {},\n required: [],\n }) as JSONSchema\n\n const inputSchema = {\n type: 'object' as const,\n properties: jsonSchema.properties || null,\n required: jsonSchema.required || null,\n }\n\n return {\n name: tool.name,\n type: 'custom',\n description: tool.description,\n input_schema: inputSchema,\n cache_control: metadata.cacheControl || null,\n }\n}\n\nexport function customTool(\n name: string,\n description: string,\n inputSchema: SchemaInput,\n cacheControl?: CacheControl | null,\n): Tool {\n return {\n name,\n description,\n inputSchema,\n metadata: {\n cacheControl,\n },\n }\n}\n"],"names":[],"mappings":"AA4BO,SAAS,iCAAiC,MAA8B;AAC7E,QAAM,WACH,KAAK,YAAmE,CAAA;AAE3E,QAAM,aAAc,KAAK,eAAe;AAAA,IAEtC,YAAY,CAAA;AAAA,IACZ,UAAU,CAAA;AAAA,EAAC;AAGb,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,IACN,YAAY,WAAW,cAAc;AAAA,IACrC,UAAU,WAAW,YAAY;AAAA,EAAA;AAGnC,SAAO;AAAA,IACL,MAAM,KAAK;AAAA,IACX,MAAM;AAAA,IACN,aAAa,KAAK;AAAA,IAClB,cAAc;AAAA,IACd,eAAe,SAAS,gBAAgB;AAAA,EAAA;AAE5C;AAEO,SAAS,WACd,MACA,aACA,aACA,cACM;AACN,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -6,5 +6,12 @@ import { MemoryTool } from './memory-tool.js';
6
6
  import { TextEditorTool } from './text-editor-tool.js';
7
7
  import { WebFetchTool } from './web-fetch-tool.js';
8
8
  import { WebSearchTool } from './web-search-tool.js';
9
+ export { bashTool, type AnthropicBashTool, type BashToolConfig, type BashTool, } from './bash-tool.js';
10
+ export { codeExecutionTool, type AnthropicCodeExecutionTool, type CodeExecutionToolConfig, type CodeExecutionTool, } from './code-execution-tool.js';
11
+ export { computerUseTool, type AnthropicComputerUseTool, type ComputerUseToolConfig, type ComputerUseTool, } from './computer-use-tool.js';
12
+ export { customTool, type CustomToolConfig, type CustomTool, } from './custom-tool.js';
13
+ export { memoryTool, type AnthropicMemoryTool, type MemoryToolConfig, type MemoryTool, } from './memory-tool.js';
14
+ export { textEditorTool, type AnthropicTextEditorTool, type TextEditorToolConfig, type TextEditorTool, } from './text-editor-tool.js';
15
+ export { webFetchTool, type AnthropicWebFetchTool, type WebFetchToolConfig, type WebFetchTool, } from './web-fetch-tool.js';
16
+ export { webSearchTool, type AnthropicWebSearchTool, type WebSearchToolConfig, type WebSearchTool, } from './web-search-tool.js';
9
17
  export type AnthropicTool = BashTool | CodeExecutionTool | ComputerUseTool | CustomTool | MemoryTool | TextEditorTool | WebFetchTool | WebSearchTool;
10
- export type { CustomTool, };
@@ -0,0 +1,19 @@
1
+ import { bashTool } from "./bash-tool.js";
2
+ import { codeExecutionTool } from "./code-execution-tool.js";
3
+ import { computerUseTool } from "./computer-use-tool.js";
4
+ import { customTool } from "./custom-tool.js";
5
+ import { memoryTool } from "./memory-tool.js";
6
+ import { textEditorTool } from "./text-editor-tool.js";
7
+ import { webFetchTool } from "./web-fetch-tool.js";
8
+ import { webSearchTool } from "./web-search-tool.js";
9
+ export {
10
+ bashTool,
11
+ codeExecutionTool,
12
+ computerUseTool,
13
+ customTool,
14
+ memoryTool,
15
+ textEditorTool,
16
+ webFetchTool,
17
+ webSearchTool
18
+ };
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,5 +1,8 @@
1
1
  import { BetaMemoryTool20250818 } from '@anthropic-ai/sdk/resources/beta';
2
- import { Tool } from '@tanstack/ai';
3
- export type MemoryTool = BetaMemoryTool20250818;
4
- export declare function convertMemoryToolToAdapterFormat(tool: Tool): MemoryTool;
5
- export declare function memoryTool(config?: MemoryTool): Tool;
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type MemoryToolConfig = BetaMemoryTool20250818;
4
+ /** @deprecated Renamed to `MemoryToolConfig`. Will be removed in a future release. */
5
+ export type MemoryTool = MemoryToolConfig;
6
+ export type AnthropicMemoryTool = ProviderTool<'anthropic', 'memory'>;
7
+ export declare function convertMemoryToolToAdapterFormat(tool: Tool): MemoryToolConfig;
8
+ export declare function memoryTool(config?: MemoryToolConfig): AnthropicMemoryTool;
@@ -5,7 +5,15 @@ function convertMemoryToolToAdapterFormat(tool) {
5
5
  ...metadata
6
6
  };
7
7
  }
8
+ function memoryTool(config) {
9
+ return {
10
+ name: "memory",
11
+ description: "",
12
+ metadata: config
13
+ };
14
+ }
8
15
  export {
9
- convertMemoryToolToAdapterFormat
16
+ convertMemoryToolToAdapterFormat,
17
+ memoryTool
10
18
  };
11
19
  //# sourceMappingURL=memory-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-tool.js","sources":["../../../src/tools/memory-tool.ts"],"sourcesContent":["import type { BetaMemoryTool20250818 } from '@anthropic-ai/sdk/resources/beta'\nimport type { Tool } from '@tanstack/ai'\n\nexport type MemoryTool = BetaMemoryTool20250818\n\nexport function convertMemoryToolToAdapterFormat(tool: Tool): MemoryTool {\n const metadata = tool.metadata as Omit<MemoryTool, 'type'>\n return {\n type: 'memory_20250818',\n ...metadata,\n }\n}\n\nexport function memoryTool(config?: MemoryTool): Tool {\n return {\n name: 'memory',\n description: '',\n metadata: config,\n }\n}\n"],"names":[],"mappings":"AAKO,SAAS,iCAAiC,MAAwB;AACvE,QAAM,WAAW,KAAK;AACtB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,GAAG;AAAA,EAAA;AAEP;"}
1
+ {"version":3,"file":"memory-tool.js","sources":["../../../src/tools/memory-tool.ts"],"sourcesContent":["import type { BetaMemoryTool20250818 } from '@anthropic-ai/sdk/resources/beta'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type MemoryToolConfig = BetaMemoryTool20250818\n\n/** @deprecated Renamed to `MemoryToolConfig`. Will be removed in a future release. */\nexport type MemoryTool = MemoryToolConfig\n\nexport type AnthropicMemoryTool = ProviderTool<'anthropic', 'memory'>\n\nexport function convertMemoryToolToAdapterFormat(tool: Tool): MemoryToolConfig {\n const metadata = tool.metadata as Omit<MemoryToolConfig, 'type'>\n return {\n type: 'memory_20250818',\n ...metadata,\n }\n}\n\nexport function memoryTool(config?: MemoryToolConfig): AnthropicMemoryTool {\n // Phantom-brand cast: '~provider'/'~toolKind' are type-only and never assigned at runtime.\n return {\n name: 'memory',\n description: '',\n metadata: config,\n } as unknown as AnthropicMemoryTool\n}\n"],"names":[],"mappings":"AAUO,SAAS,iCAAiC,MAA8B;AAC7E,QAAM,WAAW,KAAK;AACtB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,GAAG;AAAA,EAAA;AAEP;AAEO,SAAS,WAAW,QAAgD;AAEzE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EAAA;AAEd;"}
@@ -1,5 +1,8 @@
1
1
  import { ToolTextEditor20250124, ToolTextEditor20250429, ToolTextEditor20250728 } from '@anthropic-ai/sdk/resources/messages';
2
- import { Tool } from '@tanstack/ai';
3
- export type TextEditorTool = ToolTextEditor20250124 | ToolTextEditor20250429 | ToolTextEditor20250728;
4
- export declare function convertTextEditorToolToAdapterFormat(tool: Tool): TextEditorTool;
5
- export declare function textEditorTool<T extends TextEditorTool>(config: T): Tool;
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type TextEditorToolConfig = ToolTextEditor20250124 | ToolTextEditor20250429 | ToolTextEditor20250728;
4
+ /** @deprecated Renamed to `TextEditorToolConfig`. Will be removed in a future release. */
5
+ export type TextEditorTool = TextEditorToolConfig;
6
+ export type AnthropicTextEditorTool = ProviderTool<'anthropic', 'text_editor'>;
7
+ export declare function convertTextEditorToolToAdapterFormat(tool: Tool): TextEditorToolConfig;
8
+ export declare function textEditorTool<T extends TextEditorToolConfig>(config: T): AnthropicTextEditorTool;
@@ -4,7 +4,15 @@ function convertTextEditorToolToAdapterFormat(tool) {
4
4
  ...metadata
5
5
  };
6
6
  }
7
+ function textEditorTool(config) {
8
+ return {
9
+ name: "str_replace_editor",
10
+ description: "",
11
+ metadata: config
12
+ };
13
+ }
7
14
  export {
8
- convertTextEditorToolToAdapterFormat
15
+ convertTextEditorToolToAdapterFormat,
16
+ textEditorTool
9
17
  };
10
18
  //# sourceMappingURL=text-editor-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-editor-tool.js","sources":["../../../src/tools/text-editor-tool.ts"],"sourcesContent":["import type {\n ToolTextEditor20250124,\n ToolTextEditor20250429,\n ToolTextEditor20250728,\n} from '@anthropic-ai/sdk/resources/messages'\nimport type { Tool } from '@tanstack/ai'\n\nexport type TextEditorTool =\n | ToolTextEditor20250124\n | ToolTextEditor20250429\n | ToolTextEditor20250728\n\nexport function convertTextEditorToolToAdapterFormat(\n tool: Tool,\n): TextEditorTool {\n const metadata = tool.metadata as TextEditorTool\n return {\n ...metadata,\n }\n}\n\nexport function textEditorTool<T extends TextEditorTool>(config: T): Tool {\n return {\n name: 'str_replace_editor',\n description: '',\n metadata: config,\n }\n}\n"],"names":[],"mappings":"AAYO,SAAS,qCACd,MACgB;AAChB,QAAM,WAAW,KAAK;AACtB,SAAO;AAAA,IACL,GAAG;AAAA,EAAA;AAEP;"}
1
+ {"version":3,"file":"text-editor-tool.js","sources":["../../../src/tools/text-editor-tool.ts"],"sourcesContent":["import type {\n ToolTextEditor20250124,\n ToolTextEditor20250429,\n ToolTextEditor20250728,\n} from '@anthropic-ai/sdk/resources/messages'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type TextEditorToolConfig =\n | ToolTextEditor20250124\n | ToolTextEditor20250429\n | ToolTextEditor20250728\n\n/** @deprecated Renamed to `TextEditorToolConfig`. Will be removed in a future release. */\nexport type TextEditorTool = TextEditorToolConfig\n\nexport type AnthropicTextEditorTool = ProviderTool<'anthropic', 'text_editor'>\n\nexport function convertTextEditorToolToAdapterFormat(\n tool: Tool,\n): TextEditorToolConfig {\n const metadata = tool.metadata as TextEditorToolConfig\n return {\n ...metadata,\n }\n}\n\nexport function textEditorTool<T extends TextEditorToolConfig>(\n config: T,\n): AnthropicTextEditorTool {\n // Phantom-brand cast: '~provider'/'~toolKind' are type-only and never assigned at runtime.\n return {\n name: 'str_replace_editor',\n description: '',\n metadata: config,\n } as unknown as AnthropicTextEditorTool\n}\n"],"names":[],"mappings":"AAiBO,SAAS,qCACd,MACsB;AACtB,QAAM,WAAW,KAAK;AACtB,SAAO;AAAA,IACL,GAAG;AAAA,EAAA;AAEP;AAEO,SAAS,eACd,QACyB;AAEzB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EAAA;AAEd;"}
@@ -1,5 +1,8 @@
1
1
  import { BetaWebFetchTool20250910 } from '@anthropic-ai/sdk/resources/beta';
2
- import { Tool } from '@tanstack/ai';
3
- export type WebFetchTool = BetaWebFetchTool20250910;
4
- export declare function convertWebFetchToolToAdapterFormat(tool: Tool): WebFetchTool;
5
- export declare function webFetchTool(config?: Omit<WebFetchTool, 'type' | 'name'>): Tool;
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type WebFetchToolConfig = BetaWebFetchTool20250910;
4
+ /** @deprecated Renamed to `WebFetchToolConfig`. Will be removed in a future release. */
5
+ export type WebFetchTool = WebFetchToolConfig;
6
+ export type AnthropicWebFetchTool = ProviderTool<'anthropic', 'web_fetch'>;
7
+ export declare function convertWebFetchToolToAdapterFormat(tool: Tool): WebFetchToolConfig;
8
+ export declare function webFetchTool(config?: Omit<WebFetchToolConfig, 'type' | 'name'>): AnthropicWebFetchTool;
@@ -6,7 +6,15 @@ function convertWebFetchToolToAdapterFormat(tool) {
6
6
  ...metadata
7
7
  };
8
8
  }
9
+ function webFetchTool(config) {
10
+ return {
11
+ name: "web_fetch",
12
+ description: "",
13
+ metadata: config
14
+ };
15
+ }
9
16
  export {
10
- convertWebFetchToolToAdapterFormat
17
+ convertWebFetchToolToAdapterFormat,
18
+ webFetchTool
11
19
  };
12
20
  //# sourceMappingURL=web-fetch-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-fetch-tool.js","sources":["../../../src/tools/web-fetch-tool.ts"],"sourcesContent":["import type { BetaWebFetchTool20250910 } from '@anthropic-ai/sdk/resources/beta'\nimport type { Tool } from '@tanstack/ai'\n\nexport type WebFetchTool = BetaWebFetchTool20250910\n\nexport function convertWebFetchToolToAdapterFormat(tool: Tool): WebFetchTool {\n const metadata = tool.metadata as Omit<WebFetchTool, 'type' | 'name'>\n return {\n name: 'web_fetch',\n type: 'web_fetch_20250910',\n ...metadata,\n }\n}\n\nexport function webFetchTool(\n config?: Omit<WebFetchTool, 'type' | 'name'>,\n): Tool {\n return {\n name: 'web_fetch',\n description: '',\n metadata: config,\n }\n}\n"],"names":[],"mappings":"AAKO,SAAS,mCAAmC,MAA0B;AAC3E,QAAM,WAAW,KAAK;AACtB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,GAAG;AAAA,EAAA;AAEP;"}
1
+ {"version":3,"file":"web-fetch-tool.js","sources":["../../../src/tools/web-fetch-tool.ts"],"sourcesContent":["import type { BetaWebFetchTool20250910 } from '@anthropic-ai/sdk/resources/beta'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type WebFetchToolConfig = BetaWebFetchTool20250910\n\n/** @deprecated Renamed to `WebFetchToolConfig`. Will be removed in a future release. */\nexport type WebFetchTool = WebFetchToolConfig\n\nexport type AnthropicWebFetchTool = ProviderTool<'anthropic', 'web_fetch'>\n\nexport function convertWebFetchToolToAdapterFormat(\n tool: Tool,\n): WebFetchToolConfig {\n const metadata = tool.metadata as Omit<WebFetchToolConfig, 'type' | 'name'>\n return {\n name: 'web_fetch',\n type: 'web_fetch_20250910',\n ...metadata,\n }\n}\n\nexport function webFetchTool(\n config?: Omit<WebFetchToolConfig, 'type' | 'name'>,\n): AnthropicWebFetchTool {\n // Phantom-brand cast: '~provider'/'~toolKind' are type-only and never assigned at runtime.\n return {\n name: 'web_fetch',\n description: '',\n metadata: config,\n } as unknown as AnthropicWebFetchTool\n}\n"],"names":[],"mappings":"AAUO,SAAS,mCACd,MACoB;AACpB,QAAM,WAAW,KAAK;AACtB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,GAAG;AAAA,EAAA;AAEP;AAEO,SAAS,aACd,QACuB;AAEvB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EAAA;AAEd;"}
@@ -1,5 +1,8 @@
1
1
  import { WebSearchTool20250305 } from '@anthropic-ai/sdk/resources/messages';
2
- import { Tool } from '@tanstack/ai';
3
- export type WebSearchTool = WebSearchTool20250305;
4
- export declare function convertWebSearchToolToAdapterFormat(tool: Tool): WebSearchTool;
5
- export declare function webSearchTool(config: WebSearchTool): Tool;
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type WebSearchToolConfig = WebSearchTool20250305;
4
+ /** @deprecated Renamed to `WebSearchToolConfig`. Will be removed in a future release. */
5
+ export type WebSearchTool = WebSearchToolConfig;
6
+ export type AnthropicWebSearchTool = ProviderTool<'anthropic', 'web_search'>;
7
+ export declare function convertWebSearchToolToAdapterFormat(tool: Tool): WebSearchToolConfig;
8
+ export declare function webSearchTool(config: WebSearchToolConfig): AnthropicWebSearchTool;
@@ -1,3 +1,33 @@
1
+ const validateDomains = (tool) => {
2
+ if (tool.allowed_domains && tool.blocked_domains) {
3
+ throw new Error(
4
+ "allowed_domains and blocked_domains cannot be used together."
5
+ );
6
+ }
7
+ };
8
+ const validateUserLocation = (tool) => {
9
+ const userLocation = tool.user_location;
10
+ if (userLocation) {
11
+ if (userLocation.city && (userLocation.city.length < 1 || userLocation.city.length > 255)) {
12
+ throw new Error(
13
+ "user_location.city must be between 1 and 255 characters."
14
+ );
15
+ }
16
+ if (userLocation.country && userLocation.country.length !== 2) {
17
+ throw new Error("user_location.country must be exactly 2 characters.");
18
+ }
19
+ if (userLocation.region && (userLocation.region.length < 1 || userLocation.region.length > 255)) {
20
+ throw new Error(
21
+ "user_location.region must be between 1 and 255 characters."
22
+ );
23
+ }
24
+ if (userLocation.timezone && (userLocation.timezone.length < 1 || userLocation.timezone.length > 255)) {
25
+ throw new Error(
26
+ "user_location.timezone must be between 1 and 255 characters."
27
+ );
28
+ }
29
+ }
30
+ };
1
31
  function convertWebSearchToolToAdapterFormat(tool) {
2
32
  const metadata = tool.metadata;
3
33
  return {
@@ -10,7 +40,17 @@ function convertWebSearchToolToAdapterFormat(tool) {
10
40
  cache_control: metadata.cacheControl || null
11
41
  };
12
42
  }
43
+ function webSearchTool(config) {
44
+ validateDomains(config);
45
+ validateUserLocation(config);
46
+ return {
47
+ name: "web_search",
48
+ description: "",
49
+ metadata: config
50
+ };
51
+ }
13
52
  export {
14
- convertWebSearchToolToAdapterFormat
53
+ convertWebSearchToolToAdapterFormat,
54
+ webSearchTool
15
55
  };
16
56
  //# sourceMappingURL=web-search-tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-search-tool.js","sources":["../../../src/tools/web-search-tool.ts"],"sourcesContent":["import type { WebSearchTool20250305 } from '@anthropic-ai/sdk/resources/messages'\nimport type { CacheControl } from '../text/text-provider-options'\nimport type { Tool } from '@tanstack/ai'\n\nexport type WebSearchTool = WebSearchTool20250305\n\nconst validateDomains = (tool: WebSearchTool) => {\n if (tool.allowed_domains && tool.blocked_domains) {\n throw new Error(\n 'allowed_domains and blocked_domains cannot be used together.',\n )\n }\n}\n\nconst validateUserLocation = (tool: WebSearchTool) => {\n const userLocation = tool.user_location\n if (userLocation) {\n if (\n userLocation.city &&\n (userLocation.city.length < 1 || userLocation.city.length > 255)\n ) {\n throw new Error(\n 'user_location.city must be between 1 and 255 characters.',\n )\n }\n if (userLocation.country && userLocation.country.length !== 2) {\n throw new Error('user_location.country must be exactly 2 characters.')\n }\n if (\n userLocation.region &&\n (userLocation.region.length < 1 || userLocation.region.length > 255)\n ) {\n throw new Error(\n 'user_location.region must be between 1 and 255 characters.',\n )\n }\n if (\n userLocation.timezone &&\n (userLocation.timezone.length < 1 || userLocation.timezone.length > 255)\n ) {\n throw new Error(\n 'user_location.timezone must be between 1 and 255 characters.',\n )\n }\n }\n}\n\nexport function convertWebSearchToolToAdapterFormat(tool: Tool): WebSearchTool {\n const metadata = tool.metadata as {\n allowedDomains?: Array<string> | null\n blockedDomains?: Array<string> | null\n maxUses?: number | null\n userLocation?: {\n type: 'approximate'\n city?: string | null\n country?: string | null\n region?: string | null\n timezone?: string | null\n } | null\n cacheControl?: CacheControl | null\n }\n return {\n name: 'web_search',\n type: 'web_search_20250305',\n allowed_domains: metadata.allowedDomains,\n blocked_domains: metadata.blockedDomains,\n max_uses: metadata.maxUses,\n user_location: metadata.userLocation,\n cache_control: metadata.cacheControl || null,\n }\n}\n\nexport function webSearchTool(config: WebSearchTool): Tool {\n validateDomains(config)\n validateUserLocation(config)\n return {\n name: 'web_search',\n description: '',\n metadata: config,\n }\n}\n"],"names":[],"mappings":"AA+CO,SAAS,oCAAoC,MAA2B;AAC7E,QAAM,WAAW,KAAK;AAatB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB,SAAS;AAAA,IAC1B,iBAAiB,SAAS;AAAA,IAC1B,UAAU,SAAS;AAAA,IACnB,eAAe,SAAS;AAAA,IACxB,eAAe,SAAS,gBAAgB;AAAA,EAAA;AAE5C;"}
1
+ {"version":3,"file":"web-search-tool.js","sources":["../../../src/tools/web-search-tool.ts"],"sourcesContent":["import type { WebSearchTool20250305 } from '@anthropic-ai/sdk/resources/messages'\nimport type { CacheControl } from '../text/text-provider-options'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type WebSearchToolConfig = WebSearchTool20250305\n\n/** @deprecated Renamed to `WebSearchToolConfig`. Will be removed in a future release. */\nexport type WebSearchTool = WebSearchToolConfig\n\nexport type AnthropicWebSearchTool = ProviderTool<'anthropic', 'web_search'>\n\nconst validateDomains = (tool: WebSearchToolConfig) => {\n if (tool.allowed_domains && tool.blocked_domains) {\n throw new Error(\n 'allowed_domains and blocked_domains cannot be used together.',\n )\n }\n}\n\nconst validateUserLocation = (tool: WebSearchToolConfig) => {\n const userLocation = tool.user_location\n if (userLocation) {\n if (\n userLocation.city &&\n (userLocation.city.length < 1 || userLocation.city.length > 255)\n ) {\n throw new Error(\n 'user_location.city must be between 1 and 255 characters.',\n )\n }\n if (userLocation.country && userLocation.country.length !== 2) {\n throw new Error('user_location.country must be exactly 2 characters.')\n }\n if (\n userLocation.region &&\n (userLocation.region.length < 1 || userLocation.region.length > 255)\n ) {\n throw new Error(\n 'user_location.region must be between 1 and 255 characters.',\n )\n }\n if (\n userLocation.timezone &&\n (userLocation.timezone.length < 1 || userLocation.timezone.length > 255)\n ) {\n throw new Error(\n 'user_location.timezone must be between 1 and 255 characters.',\n )\n }\n }\n}\n\nexport function convertWebSearchToolToAdapterFormat(\n tool: Tool,\n): WebSearchToolConfig {\n const metadata = tool.metadata as {\n allowedDomains?: Array<string> | null\n blockedDomains?: Array<string> | null\n maxUses?: number | null\n userLocation?: {\n type: 'approximate'\n city?: string | null\n country?: string | null\n region?: string | null\n timezone?: string | null\n } | null\n cacheControl?: CacheControl | null\n }\n return {\n name: 'web_search',\n type: 'web_search_20250305',\n allowed_domains: metadata.allowedDomains,\n blocked_domains: metadata.blockedDomains,\n max_uses: metadata.maxUses,\n user_location: metadata.userLocation,\n cache_control: metadata.cacheControl || null,\n }\n}\n\nexport function webSearchTool(\n config: WebSearchToolConfig,\n): AnthropicWebSearchTool {\n validateDomains(config)\n validateUserLocation(config)\n // Phantom-brand cast: '~provider'/'~toolKind' are type-only and never assigned at runtime.\n return {\n name: 'web_search',\n description: '',\n metadata: config,\n } as unknown as AnthropicWebSearchTool\n}\n"],"names":[],"mappings":"AAWA,MAAM,kBAAkB,CAAC,SAA8B;AACrD,MAAI,KAAK,mBAAmB,KAAK,iBAAiB;AAChD,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACF;AAEA,MAAM,uBAAuB,CAAC,SAA8B;AAC1D,QAAM,eAAe,KAAK;AAC1B,MAAI,cAAc;AAChB,QACE,aAAa,SACZ,aAAa,KAAK,SAAS,KAAK,aAAa,KAAK,SAAS,MAC5D;AACA,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AACA,QAAI,aAAa,WAAW,aAAa,QAAQ,WAAW,GAAG;AAC7D,YAAM,IAAI,MAAM,qDAAqD;AAAA,IACvE;AACA,QACE,aAAa,WACZ,aAAa,OAAO,SAAS,KAAK,aAAa,OAAO,SAAS,MAChE;AACA,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AACA,QACE,aAAa,aACZ,aAAa,SAAS,SAAS,KAAK,aAAa,SAAS,SAAS,MACpE;AACA,YAAM,IAAI;AAAA,QACR;AAAA,MAAA;AAAA,IAEJ;AAAA,EACF;AACF;AAEO,SAAS,oCACd,MACqB;AACrB,QAAM,WAAW,KAAK;AAatB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB,SAAS;AAAA,IAC1B,iBAAiB,SAAS;AAAA,IAC1B,UAAU,SAAS;AAAA,IACnB,eAAe,SAAS;AAAA,IACxB,eAAe,SAAS,gBAAgB;AAAA,EAAA;AAE5C;AAEO,SAAS,cACd,QACwB;AACxB,kBAAgB,MAAM;AACtB,uBAAqB,MAAM;AAE3B,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EAAA;AAEd;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/ai-anthropic",
3
- "version": "0.7.5",
3
+ "version": "0.8.0",
4
4
  "description": "Anthropic Claude adapter for TanStack AI",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -23,6 +23,10 @@
23
23
  ".": {
24
24
  "types": "./dist/esm/index.d.ts",
25
25
  "import": "./dist/esm/index.js"
26
+ },
27
+ "./tools": {
28
+ "types": "./dist/esm/tools/index.d.ts",
29
+ "import": "./dist/esm/tools/index.js"
26
30
  }
27
31
  },
28
32
  "files": [
@@ -34,12 +38,12 @@
34
38
  },
35
39
  "peerDependencies": {
36
40
  "zod": "^4.0.0",
37
- "@tanstack/ai": "^0.11.0"
41
+ "@tanstack/ai": "^0.12.0"
38
42
  },
39
43
  "devDependencies": {
40
44
  "@vitest/coverage-v8": "4.0.14",
41
45
  "zod": "^4.2.0",
42
- "@tanstack/ai": "0.11.0"
46
+ "@tanstack/ai": "0.12.0"
43
47
  },
44
48
  "scripts": {
45
49
  "build": "vite build",
@@ -9,6 +9,7 @@ import {
9
9
  import type {
10
10
  ANTHROPIC_MODELS,
11
11
  AnthropicChatModelProviderOptionsByName,
12
+ AnthropicChatModelToolCapabilitiesByName,
12
13
  AnthropicModelInputModalitiesByName,
13
14
  } from '../model-meta'
14
15
  import type {
@@ -89,6 +90,11 @@ type ResolveInputModalities<TModel extends string> =
89
90
  ? AnthropicModelInputModalitiesByName[TModel]
90
91
  : readonly ['text', 'image', 'document']
91
92
 
93
+ type ResolveToolCapabilities<TModel extends string> =
94
+ TModel extends keyof AnthropicChatModelToolCapabilitiesByName
95
+ ? NonNullable<AnthropicChatModelToolCapabilitiesByName[TModel]>
96
+ : readonly []
97
+
92
98
  // ===========================
93
99
  // Adapter Implementation
94
100
  // ===========================
@@ -101,14 +107,17 @@ type ResolveInputModalities<TModel extends string> =
101
107
  */
102
108
  export class AnthropicTextAdapter<
103
109
  TModel extends (typeof ANTHROPIC_MODELS)[number],
104
- TProviderOptions extends object = ResolveProviderOptions<TModel>,
110
+ TProviderOptions extends Record<string, any> = ResolveProviderOptions<TModel>,
105
111
  TInputModalities extends ReadonlyArray<Modality> =
106
112
  ResolveInputModalities<TModel>,
113
+ TToolCapabilities extends ReadonlyArray<string> =
114
+ ResolveToolCapabilities<TModel>,
107
115
  > extends BaseTextAdapter<
108
116
  TModel,
109
117
  TProviderOptions,
110
118
  TInputModalities,
111
- AnthropicMessageMetadataByModality
119
+ AnthropicMessageMetadataByModality,
120
+ TToolCapabilities
112
121
  > {
113
122
  readonly kind = 'text' as const
114
123
  readonly name = 'anthropic' as const
@@ -121,7 +130,7 @@ export class AnthropicTextAdapter<
121
130
  }
122
131
 
123
132
  async *chatStream(
124
- options: TextOptions<AnthropicTextProviderOptions>,
133
+ options: TextOptions<TProviderOptions>,
125
134
  ): AsyncIterable<StreamChunk> {
126
135
  try {
127
136
  const requestParams = this.mapCommonOptionsToAnthropic(options)
@@ -160,7 +169,7 @@ export class AnthropicTextAdapter<
160
169
  * The outputSchema is already JSON Schema (converted in the ai layer).
161
170
  */
162
171
  async structuredOutput(
163
- options: StructuredOutputOptions<AnthropicTextProviderOptions>,
172
+ options: StructuredOutputOptions<TProviderOptions>,
164
173
  ): Promise<StructuredOutputResult<unknown>> {
165
174
  const { chatOptions, outputSchema } = options
166
175
 
package/src/index.ts CHANGED
@@ -24,9 +24,10 @@ export {
24
24
  // ============================================================================
25
25
 
26
26
  export type {
27
+ AnthropicChatModel,
27
28
  AnthropicChatModelProviderOptionsByName,
29
+ AnthropicChatModelToolCapabilitiesByName,
28
30
  AnthropicModelInputModalitiesByName,
29
- AnthropicChatModel,
30
31
  } from './model-meta'
31
32
  export { ANTHROPIC_MODELS } from './model-meta'
32
33
  export type {
package/src/model-meta.ts CHANGED
@@ -21,6 +21,15 @@ interface ModelMeta<
21
21
  extended_thinking?: boolean
22
22
  adaptive_thinking?: boolean
23
23
  priority_tier?: boolean
24
+ tools?: Array<
25
+ | 'web_search'
26
+ | 'web_fetch'
27
+ | 'code_execution'
28
+ | 'computer_use'
29
+ | 'bash'
30
+ | 'text_editor'
31
+ | 'memory'
32
+ >
24
33
  }
25
34
  context_window?: number
26
35
  max_output_tokens?: number
@@ -66,6 +75,15 @@ const CLAUDE_OPUS_4_6 = {
66
75
  input: ['text', 'image', 'document'],
67
76
  extended_thinking: true,
68
77
  priority_tier: true,
78
+ tools: [
79
+ 'web_search',
80
+ 'web_fetch',
81
+ 'code_execution',
82
+ 'computer_use',
83
+ 'bash',
84
+ 'text_editor',
85
+ 'memory',
86
+ ],
69
87
  },
70
88
  } as const satisfies ModelMeta<
71
89
  AnthropicContainerOptions &
@@ -96,6 +114,15 @@ const CLAUDE_OPUS_4_5 = {
96
114
  input: ['text', 'image', 'document'],
97
115
  extended_thinking: true,
98
116
  priority_tier: true,
117
+ tools: [
118
+ 'web_search',
119
+ 'web_fetch',
120
+ 'code_execution',
121
+ 'computer_use',
122
+ 'bash',
123
+ 'text_editor',
124
+ 'memory',
125
+ ],
99
126
  },
100
127
  } as const satisfies ModelMeta<
101
128
  AnthropicContainerOptions &
@@ -127,6 +154,15 @@ const CLAUDE_SONNET_4_6 = {
127
154
  extended_thinking: true,
128
155
  adaptive_thinking: true,
129
156
  priority_tier: true,
157
+ tools: [
158
+ 'web_search',
159
+ 'web_fetch',
160
+ 'code_execution',
161
+ 'computer_use',
162
+ 'bash',
163
+ 'text_editor',
164
+ 'memory',
165
+ ],
130
166
  },
131
167
  } as const satisfies ModelMeta<
132
168
  AnthropicContainerOptions &
@@ -157,6 +193,15 @@ const CLAUDE_SONNET_4_5 = {
157
193
  input: ['text', 'image', 'document'],
158
194
  extended_thinking: true,
159
195
  priority_tier: true,
196
+ tools: [
197
+ 'web_search',
198
+ 'web_fetch',
199
+ 'code_execution',
200
+ 'computer_use',
201
+ 'bash',
202
+ 'text_editor',
203
+ 'memory',
204
+ ],
160
205
  },
161
206
  } as const satisfies ModelMeta<
162
207
  AnthropicContainerOptions &
@@ -187,6 +232,15 @@ const CLAUDE_HAIKU_4_5 = {
187
232
  input: ['text', 'image', 'document'],
188
233
  extended_thinking: true,
189
234
  priority_tier: true,
235
+ tools: [
236
+ 'web_search',
237
+ 'web_fetch',
238
+ 'code_execution',
239
+ 'computer_use',
240
+ 'bash',
241
+ 'text_editor',
242
+ 'memory',
243
+ ],
190
244
  },
191
245
  } as const satisfies ModelMeta<
192
246
  AnthropicContainerOptions &
@@ -217,6 +271,15 @@ const CLAUDE_OPUS_4_1 = {
217
271
  input: ['text', 'image', 'document'],
218
272
  extended_thinking: true,
219
273
  priority_tier: true,
274
+ tools: [
275
+ 'web_search',
276
+ 'web_fetch',
277
+ 'code_execution',
278
+ 'computer_use',
279
+ 'bash',
280
+ 'text_editor',
281
+ 'memory',
282
+ ],
220
283
  },
221
284
  } as const satisfies ModelMeta<
222
285
  AnthropicContainerOptions &
@@ -247,6 +310,15 @@ const CLAUDE_SONNET_4 = {
247
310
  input: ['text', 'image', 'document'],
248
311
  extended_thinking: true,
249
312
  priority_tier: true,
313
+ tools: [
314
+ 'web_search',
315
+ 'web_fetch',
316
+ 'code_execution',
317
+ 'computer_use',
318
+ 'bash',
319
+ 'text_editor',
320
+ 'memory',
321
+ ],
250
322
  },
251
323
  } as const satisfies ModelMeta<
252
324
  AnthropicContainerOptions &
@@ -276,6 +348,15 @@ const CLAUDE_SONNET_3_7 = {
276
348
  input: ['text', 'image', 'document'],
277
349
  extended_thinking: true,
278
350
  priority_tier: true,
351
+ tools: [
352
+ 'web_search',
353
+ 'web_fetch',
354
+ 'code_execution',
355
+ 'computer_use',
356
+ 'bash',
357
+ 'text_editor',
358
+ 'memory',
359
+ ],
279
360
  },
280
361
  } as const satisfies ModelMeta<
281
362
  AnthropicContainerOptions &
@@ -306,6 +387,15 @@ const CLAUDE_OPUS_4 = {
306
387
  input: ['text', 'image', 'document'],
307
388
  extended_thinking: true,
308
389
  priority_tier: true,
390
+ tools: [
391
+ 'web_search',
392
+ 'web_fetch',
393
+ 'code_execution',
394
+ 'computer_use',
395
+ 'bash',
396
+ 'text_editor',
397
+ 'memory',
398
+ ],
309
399
  },
310
400
  } as const satisfies ModelMeta<
311
401
  AnthropicContainerOptions &
@@ -336,6 +426,7 @@ const CLAUDE_HAIKU_3_5 = {
336
426
  input: ['text', 'image', 'document'],
337
427
  extended_thinking: false,
338
428
  priority_tier: true,
429
+ tools: ['web_search', 'web_fetch'],
339
430
  },
340
431
  } as const satisfies ModelMeta<
341
432
  AnthropicContainerOptions &
@@ -366,6 +457,7 @@ const CLAUDE_HAIKU_3 = {
366
457
  input: ['text', 'image', 'document'],
367
458
  extended_thinking: false,
368
459
  priority_tier: false,
460
+ tools: ['web_search'],
369
461
  },
370
462
  } as const satisfies ModelMeta<
371
463
  AnthropicContainerOptions &
@@ -432,6 +524,15 @@ const CLAUDE_OPUS_4_6_FAST = {
432
524
  input: ['text', 'image'],
433
525
  extended_thinking: true,
434
526
  priority_tier: true,
527
+ tools: [
528
+ 'web_search',
529
+ 'web_fetch',
530
+ 'code_execution',
531
+ 'computer_use',
532
+ 'bash',
533
+ 'text_editor',
534
+ 'memory',
535
+ ],
435
536
  },
436
537
  pricing: {
437
538
  input: {
@@ -462,6 +563,15 @@ const CLAUDE_OPUS_4_7 = {
462
563
  input: ['text', 'image'],
463
564
  extended_thinking: true,
464
565
  priority_tier: true,
566
+ tools: [
567
+ 'web_search',
568
+ 'web_fetch',
569
+ 'code_execution',
570
+ 'computer_use',
571
+ 'bash',
572
+ 'text_editor',
573
+ 'memory',
574
+ ],
465
575
  },
466
576
  pricing: {
467
577
  input: {
@@ -619,6 +729,22 @@ export type AnthropicChatModelProviderOptionsByName = {
619
729
  AnthropicSamplingOptions
620
730
  }
621
731
 
732
+ export type AnthropicChatModelToolCapabilitiesByName = {
733
+ [CLAUDE_OPUS_4_6.id]: typeof CLAUDE_OPUS_4_6.supports.tools
734
+ [CLAUDE_OPUS_4_5.id]: typeof CLAUDE_OPUS_4_5.supports.tools
735
+ [CLAUDE_SONNET_4_6.id]: typeof CLAUDE_SONNET_4_6.supports.tools
736
+ [CLAUDE_SONNET_4_5.id]: typeof CLAUDE_SONNET_4_5.supports.tools
737
+ [CLAUDE_HAIKU_4_5.id]: typeof CLAUDE_HAIKU_4_5.supports.tools
738
+ [CLAUDE_OPUS_4_1.id]: typeof CLAUDE_OPUS_4_1.supports.tools
739
+ [CLAUDE_SONNET_4.id]: typeof CLAUDE_SONNET_4.supports.tools
740
+ [CLAUDE_SONNET_3_7.id]: typeof CLAUDE_SONNET_3_7.supports.tools
741
+ [CLAUDE_OPUS_4.id]: typeof CLAUDE_OPUS_4.supports.tools
742
+ [CLAUDE_HAIKU_3_5.id]: typeof CLAUDE_HAIKU_3_5.supports.tools
743
+ [CLAUDE_HAIKU_3.id]: typeof CLAUDE_HAIKU_3.supports.tools
744
+ [CLAUDE_OPUS_4_6_FAST.id]: typeof CLAUDE_OPUS_4_6_FAST.supports.tools
745
+ [CLAUDE_OPUS_4_7.id]: typeof CLAUDE_OPUS_4_7.supports.tools
746
+ }
747
+
622
748
  /**
623
749
  * Type-only map from chat model name to its supported input modalities.
624
750
  * All Anthropic Claude models support text, image, and document (PDF) input.